Skip to content

Instantly share code, notes, and snippets.

View brentley's full-sized avatar

Brent Langston brentley

View GitHub Profile
@brentley
brentley / always_on_light.yaml
Last active October 25, 2022 20:46 — forked from beauwest/always_on_switch.yaml
Home Assistant: Always On Light
blueprint:
name: Always On Light
description: Keep the selected light on, even when it is turned off. This should be used for lights you never want to be turned off.
domain: automation
input:
target_light:
name: Target Light
description: The light that will always be kept on.
selector:
entity:
@brentley
brentley / screenshots.applescript
Created June 29, 2021 14:21 — forked from toricls/screenshots.applescript
Take screenshots with consistent size and location with AppleScript in Automator.app
set theDate to do shell script "date +%Y_%m_%d_%H%M%S"
set theDirectory to POSIX path of (path to desktop)
set thePath to theDirectory & "screenCapture_" & theDate & ".png"
# -R557,308,810,513 is the rectangle option: x,y,w,h
do shell script "screencapture -R557,308,810,513 -tpng" & space & quoted form of thePath
AZ,Availability Zone
ASG,Auto Scaling Group
EBS,Elastic Block Store
ENI,Elastic Network Interface
EIP,Elastic IP
IGW,Internet Gateway
CM,AWS Certificate Manager
ADS,Application Discovery Service
GWY,Amazon API Gateway
GWYv2,Amazon API Gateway V2
@brentley
brentley / puppeteer_youtube.js
Created December 10, 2020 23:08 — forked from tnolet/puppeteer_youtube.js
Puppeteer search youtube
const puppeteer = require('puppeteer')
const screenshot = 'youtube_fm_dreams_video.png'
try {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('https://youtube.com')
await page.type('#search', 'Fleetwood Mac Dreams')
await page.click('button#search-icon-legacy')
await page.waitForSelector('ytd-thumbnail.ytd-video-renderer')
@brentley
brentley / tampermonkey.js
Created August 10, 2020 23:42 — forked from rothgar/streamyard-tampermonkey.js
Streamyard Keyboard Shortcuts
// ==UserScript==
// @name Streamyard Keyboard Shortcuts
// @namespace http://streamyard.com
// @version 0.1
// @description Simple keyboard shortcuts for streamyard
// @author justinleegarrison@gmail.com
// @match https://streamyard.com/*
// @grant none
// @run-at document-end
// ==/UserScript==

TL;DR The Facebook and Messenger apps are battery hogs. Replace them if possible.


I'll start by saying these experiments aren't highly scientific, but I tried to be as consistent as possible.

For each iteration, I tested from 100% charge to 97% charge. I wanted to test more than 1% because my phone seems to go from 100 to 99 relatively fast, but 99 to 98

@brentley
brentley / README.md
Created July 6, 2019 15:16 — forked from pamolloy/README.md
Ubiquiti USG configuration for Wireguard

Download the latest ugw3 package from https://github.com/Lochnair/vyatta-wireguard/releases and install it on your USG using dpkg -i wireguard-ugw3-<version>.deb.

cd /config/auth
umask 077
mkdir wireguard
cd wireguard
wg genkey > wg_private.key
wg pubkey < wg_private.key > wg_public.key
@brentley
brentley / WireGuard_Setup.txt
Created July 6, 2019 15:11 — forked from chrisswanda/WireGuard_Setup.txt
Stupid simple setting up WireGuard - Server and multiple peers
Install WireGuard via whatever package manager you use. For me, I use apt.
$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard
MacOS
$ brew install wireguard-tools
Generate key your key pairs. The key pairs are just that, key pairs. They can be

the first part needs to be done in a crosh shell after enabling linux in chrome settings.

(Note: I didn't do this after my most recent powerwash... the crosh commands may be unnecessary now)

ctrl-alt-t to get a crosh shell

crosh> vmc start termina
lxc profile unset default security.syscalls.blacklist
lxc profile apply penguin default
lxc restart --force penguin
@brentley
brentley / .bash_profile
Created October 24, 2018 11:03 — forked from chrisberkhout/.bash_profile
Git aliases taken from oh-my-zsh's git plugin and translated to bash
# git aliases - taken from oh-my-zsh's git plugin and translated to bash
# https://github.com/robbyrussell/oh-my-zsh/wiki/Cheatsheet#helpful-aliases-for-common-git-tasks
# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/git/git.plugin.zsh
function git_current_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}
function git_current_repository() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || \