Skip to content

Instantly share code, notes, and snippets.

View astout's full-sized avatar
💚
Living Life

Alex Stout astout

💚
Living Life
View GitHub Profile
@astout
astout / laview-homeassistant-onvif-setup.md
Last active November 28, 2025 00:23
How to Add LaView Cameras to Home Assistant via ONVIF - Step-by-step guide

How to Add LaView Cameras to Home Assistant via ONVIF

A simple step-by-step guide to integrate LaView WiFi cameras into Home Assistant using the ONVIF protocol. This also works for exposing cameras to Apple HomeKit through Home Assistant.

Why This Guide?

LaView cameras can be tricky to integrate with Home Assistant because they use non-standard ports and the automatic discovery often fails. This guide shows you exactly what settings to use.

Prerequisites

@astout
astout / 241014-mark-gmails-as-read.md
Created October 14, 2024 17:39
Mark Gmails as Read (Oct 2024)

Mark All Gmail Messages as Read

I have a Gmail account that I use primarily for giving out to businesses for promotions, rewards, etc. I don't really pay too much attention to this mailbox and it mostly collects spam. I'm obsessive about having everything "read" in my inboxes, so I wrote this script to mark all messages as read.

How it works

The script uses the following steps:

  1. Simulates keyboard shortcuts to select all unread messages.
  2. Marks the selected messages as read.
  3. Repeats the process until no more unread messages are found.
@astout
astout / count_lines.sh
Last active December 8, 2020 15:49
List number of lines in a file or in all files in a directory (non-recursive). Data is outputted in neat columns.
# author: Alex Stout
# check if the provided argument is a directory
if [[ -d $1 ]]; then
: # nop -- do nothing
elif [[ -f $1 ]]; then # or is it a file
: # nop -- do nothing
else
echo "argument is invalid"
exit 1
@astout
astout / 200221-grading.md
Last active February 22, 2020 05:24
200221 Grading
@astout
astout / 200220-grading.md
Created February 21, 2020 06:47
200220 Grading
@astout
astout / thinkful_css.md
Last active October 7, 2018 19:49
Thinkful CSS Response

CSS

Hi student,

No sweat. You're so close! It looks like you're not using flexbox which is definitely the recommended way to layout and center content. I'm going to give you a couple pieces because you're pretty much there. First, notice your pricing element is overflowing. This is because you're unnecessarily providing width: 100%, let's let the defaults handle the width here and remove that, width: 100%. This will allow the width of pricing to fill its parent without regard for the width of its own child content. Next, let's use flexbox by adding display: flex to your pricing element.

And voilà ! That should render your .pricing-tiers within the .pricing element. Does this look how it should? Definitely play around a bit with flexbox and let me know if you have anymore questions!

@astout
astout / thinkful_algorithms.md
Created October 7, 2018 19:45
Thinkful Algorithms Response

Algorithms

Hi student,

What I found most helpful when I was learning Big-O notation was to always think of it like this. Simply, Big-O notation is

How execution time scales with respect to size N of the dataset.

Here are some basic examples of different notations.

@astout
astout / thinkful_frameworks.md
Created October 7, 2018 19:43
Thinkful Frameworks Response

Frameworks/Libraries

Hi student,

Welcome to one of modern web development's most polarizing debates!

Is React a framework or a library?

According to Facebook, React is a JavaScript library. One way to think of a library is that a library is something that provides an interface to make your top-level design simpler and cleaner. I hope you are familiar with the design concept MVC (Model, View, Controller), if not, I enjoy this simple explanation from the perspective of web development.

@astout
astout / thinkful_sql.md
Created October 7, 2018 19:41
Thinkful SQL Response

SQL

Hi student,

SQL Injection is definitely a security flaw you'll always want to keep in mind when writing web applications that use SQL databases. SQL injection occurs when SQL queries are performed using standard string interpolation. Any language that supports SQL should also provide SQL libraries that provide methods to safely construct and execute SQL queries using some type of parameter sanitation method or parameter binding.

SQL Injection Examples

First, I'll show some examples of SQL injection in practice.

@astout
astout / thinkful_rails.md
Created October 7, 2018 19:39
Thinkful Rails Response

Rails

Hi student,

First, I'm glad to hear you're making progress learning Rails ActiveRecord associations. Second, before you consider yourself stuck, I would always recommend seeking out code documentation. Most good modern software has helpful documentation that should be able to steer you in the right direction. The Rails documentation has a great example on has_many :through associations. Let's use their example.

has_many tells ActiveRecord that we want each instance of this model to have associations to one or more instances of another model. Now imagine we want to simply access data of a third model that is referenced only by association of our referenced model from our first model (sorry that was a mouthful). This is where :through comes into play. Consider the following:

class Physician < ApplicationRecord