Skip to content

Instantly share code, notes, and snippets.

View birkholz's full-sized avatar

Brandon Birkholz birkholz

  • Austin, Texas
View GitHub Profile
@birkholz
birkholz / setup.md
Last active September 12, 2017 18:47

New computer set up guide

Sets up:

  • OS X preferences
  • Brew
  • fish (replacement for bash)
  • Python (with fish integrations)
  • NodeJS

OS X

Keybase proof

I hereby claim:

  • I am birkholz on github.
  • I am birkholz (https://keybase.io/birkholz) on keybase.
  • I have a public key ASBS6L5RdEnyWlppkgH6vBQ0ojxAoagaB6RGIvIQpZzEbAo

To claim this, I am signing this object:

@birkholz
birkholz / release.sh
Last active May 22, 2017 23:18
PyPi release script
#!/usr/bin/env bash
echo "WARNING: This will reset your working directory!"
echo "Please make sure all your changes are committed and merged into master."
read -p "Are you sure you want to continue? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Preparing to build..."
{
@birkholz
birkholz / 1_click_approve.js
Last active July 17, 2017 23:33
A userscript for adding a 1-click approve button to PRs
// ==UserScript==
// @name GitHub 1-click PR Approve
// @namespace https://gist.github.com/birkholz
// @description Adds a 1-click approve button to Pull Requests
// @version 3
// @author https://github.com/birkholz
// @match https://github.com/*/*/pull/*/files
// @grant none
// ==/UserScript==
@birkholz
birkholz / function_calls.md
Created October 10, 2017 19:43
Different ways of writing a python function call with parameters

Different ways of writing a function call with parameters

Example 1

Model.objects.create(
    timestamp=datetime.datetime.now(),  # The current time
    name=f'{first_name} {last_name}',  # The user's full name
    foo=True if is_thing else False  # Some boolean field
)
@birkholz
birkholz / list_products.py
Last active June 29, 2018 01:56
Product of All Other Numbers
from functools import reduce
import unittest
def multiply(int_list):
return reduce(lambda x, y: x*y, int_list)
# O(n^2)
def get_products_of_all_ints_except_at_index(int_list):
@birkholz
birkholz / permutations.py
Created June 30, 2018 03:01
Permutations of a String
import unittest
# Code
def get_permutations(input_str):
input_len = len(input_str)
results = []
if input_len == 0:
@birkholz
birkholz / twitter_dark.css
Created July 1, 2018 22:36
twitter dark theme inspired by YouTube dark mode
.ProfileHeading-content, .ProfileCanopy-navBar, .RichEditor, .NotificationsHeadingContent, .content-header .header-inner, .content-inner, .module .list-link {
background: #292929;
}
.global-nav .search-input, .RichEditor.is-fakeFocus {
background: #121212;
border: 1px solid #303030;
}
.global-nav .search-input:focus, .RichEditor.is-fakeFocus:focus {
@birkholz
birkholz / multiple_outputs.js
Last active August 9, 2020 10:33
Sending an audiostream to multiple outputs
var ac = new AudioContext();
var dest = ac.createMediaStreamDestination();
// Get permission to use non-default audio devices
// This requests microphone permission also. Perhaps there's a better way to just get output permission.
navigator.mediaDevices.getUserMedia({audio: true});
// Gets a list of output devices
const devices = await navigator.mediaDevices.enumerateDevices();
const audioDevices = devices.filter(device => device.kind === 'audiooutput');