Skip to content

Instantly share code, notes, and snippets.

View evanfoster's full-sized avatar

Evan Foster evanfoster

View GitHub Profile
@evanfoster
evanfoster / docker-wyze-bridge.yaml
Last active November 26, 2023 21:22
A very basic manifest for deploying docker-wyze-bridge. Isn't following certain best practices, should probably be a helm chart or kustomize thingy.
---
apiVersion: v1
kind: Secret
metadata:
name: docker-wyze-bridge-credentials
data:
API_ID: <>
API_KEY: <>
WYZE_EMAIL: <>
WYZE_PASSWORD: <>
@evanfoster
evanfoster / protest.zsh
Last active June 7, 2023 01:09
Grabs the total subscriber count of all protesting subreddits.
#!/usr/bin/env zsh
# set -x
# Putting this in the user's $HOME, since that seems more secure. Probably nobody else will run this,
# so the risk is really just mine.
token_file=~/.reddit_token
user_agent_file=/tmp/user-agent
echoerr () { printf '%s\n' "$@" 1>&2; }
die () {
@evanfoster
evanfoster / foo.py
Created February 12, 2018 04:22
Camera switching script for /u/akavMAC
#!/usr/bin/env python3
# Remember to either chmod +x this file and call it like this:
# */15 * * * * /path/to/foo.py >/dev/null 2>&1
# Or invoke with python3 like this:
# */15 * * * * python3 /path/to/foo.py >/dev/null 2>&1
from subprocess import run
username = 'User'
password = 'Pass'
@evanfoster
evanfoster / memfinder.py
Last active December 11, 2016 07:52
Quick script to show which slots have modules installed and give some info about each module. Requires root, Python >= 2.6 (works with 3), and dmidecode.
#!/usr/bin/python
import re
import subprocess
class MemoryBank(object):
def __repr__(self):
if self.is_populated:
return_string = """Bank Location: {0}
Location: {8}
sudo winusb --format INSERT_WINDOWS_ISO_NAME /dev/INSERT_DRIVE
# SI units, 1000 base
def sizeof_fmt_si(num, suffix='B'):
for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']:
if abs(num) < 1000.0:
return "%3.1f%s%s" % (num, unit, suffix)
num /= 1000.0
return "%.1f%s%s" % (num, 'Yi', suffix)
# Binary prefix, 1024 base
############
# Completion
############
autoload -U compinit promptinit
compinit
promptinit
############
# Shell opts
" Requires ansible-lint to be installed.
let g:neomake_ansible_ansiblelint_maker = {
\ 'exe': 'ansible-lint',
\ 'args': ['-p'],
\ 'errorformat': '%E%f:%l: [ANSIBLE%n] %m,%W%f:%l: [ANSIBLE%n] %m',
\ }
let g:neomake_ansible_enabled_makers = ['ansiblelint']
func delete_empty(s []string) []string {
var r []string
for _, str := range s {
if str != "" {
r = append(r, str)
}
}
return r
}