Skip to content

Instantly share code, notes, and snippets.

View rfong's full-sized avatar

rfong rfong

View GitHub Profile
@rfong
rfong / FOOTGUNS.md
Last active August 9, 2018 20:57
surprises

mysql

  • Max TIME is 839:59:59 (3023999 seconds), due to a 3-byte backwards compatibility hack with old versions of mysql. [1] [2]
@rfong
rfong / JOY_OF_BASH.md
Last active December 4, 2021 03:47
fun bash things

no matter how long you've been using it, bash is an endless treasure trove of hidden gems thirsting to make your life better. here is a small tasting flight of favorite bash friends I've remembered to write down.

Navigation

My personal rule of thumb: if I've typed something more than twice, it's time to turn it into a macro.

When have you ever changed directories and not wanted to see the contents of your new location? Rarely.

# cd+ls, only the most used pair of commands of all time ever
function cl() {
@rfong
rfong / profile.go
Last active May 4, 2018 18:31
golang pprof example
// Example:
// go test <options> -cpuprofile cpu.prof -memprofile mem.prof ./...
// go tool pprof # Interactive console
// go tool pprof -http=localhost:6060 cpu.prof # Visualization
import (
"flag"
"log"
"runtime"
"runtime/pprof"
@rfong
rfong / cumulative.py
Last active May 3, 2018 05:52
relationship rpg dice simulators
"""
Simulate 'Cumulative' type relationshipRPG trials.
"""
import csv
import math
import random
import time
import unittest
@rfong
rfong / GOLANG.md
Last active June 1, 2021 02:45
golang onboarding notes
@rfong
rfong / osx_10_13_antichrist.sh
Created January 16, 2018 22:44
just me preparing to upgrade to OSX 10.13
#!/bin/bash
brew update
brew upgrade
go get -u golint # and maybe more
@rfong
rfong / osx_10_12_antichrist.sh
Last active November 6, 2017 19:43
WIP; fixes for things osx 10.12 upgrade breaks
#!/bin/bash
# OSX 10.12 broke brew; I just nuked it and reinstalled
# OSX 10.12 switched from GNU grep to FreeBSD grep, breaking `grep -Po`
brew install grep --with-default-names
# System Integrity Protection fucks up a lot of dev shit
sudo chown -R $USER /usr/local
@rfong
rfong / I2C_SSD1306_ipaddr.py
Last active April 4, 2024 02:09
Display my IP address on an I2C OLED screen #raspberrypi #gpio
""" Display my IP address on an I2C OLED screen connected over GPIO """
import socket
import time
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import Adafruit_GPIO.SPI as SPI
@rfong
rfong / c920.sh
Created February 22, 2017 20:04
Bash settings w/ multiple C920 logitech cameras
#!/bin/bash
cameras=(0 1 2)
function apply_cams() {
# Apply `v4l2-ctl $@` to all cams
# Example usage: apply_cams -C focus_auto
for cam in "${cameras[@]}"; do
echo "/dev/video$cam"
v4l2-ctl -d $cam $@
@rfong
rfong / suppress-itunes.sh
Created February 22, 2017 19:18
stop iTunes from autolaunching on OSX
# Solutions from https://www.quora.com/How-do-I-disable-iTunes-from-popping-up-in-Mac-OS
# Stop daemon
## Change permissions so it can't execute. This can be done from the command line using this command:
sudo chmod -x /System/Library/CoreServices/rcd.app/Contents/MacOS
## Or, unload it using this command:
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist
# System Preferences > Users & Groups > Login Items --> remove iTunes Helper