Skip to content

Instantly share code, notes, and snippets.

View brndnblck's full-sized avatar

Brandon Black brndnblck

View GitHub Profile
brndnblck /
Last active October 31, 2019 18:25 — forked from jonathantneal/
Create or update macOS Mojave Recovery Partition Without Reinstalling
# Set the macOS installer path as a variable
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
echo "macOS installer is \"$MACOS_INSTALLER\""
# Set the target disk as a variable
TARGET=$(diskutil info "$(bless --info --getBoot)" | awk -F':' '/Volume Name/ { print $2 }' | sed -e 's/^[[:space:]]*//')
echo "Target disk is \"$TARGET\""
brndnblck / dev_setup.txt
Created April 19, 2017 20:22
Local Setup for .dev Domains (dnsmasq + nginx)
sudo -v
brew install dnsmasq nginx
echo "address=/dev/" > /usr/local/etc/dnsmasq.conf
vim /usr/local/etc/nginx/nginx.conf
vim /usr/local/etc/nginx/servers/stacksocial.conf
tee /usr/local/etc/nginx/nginx.conf > /dev/null << EOF
#user nobody;
brndnblck / GPG and git on
Created April 6, 2017 05:02 — forked from danieleggert/GPG and git on
How to set up git to use the GPG Suite

GPG and git on macOS


No need for homebrew or anything like that. Works with and the command line.

  1. Install -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
brndnblck / Blockstack
Created November 17, 2016 18:11
Blockstack Verification
Verifying that "" is my Blockstack ID.
brndnblck / workshop.rb
Last active May 19, 2024 20:19
Twitter Ads API Getting Started (Ruby)
# enable "sandbox" mode
CLIENT.options[:sandbox] = true
# load your sandbox account object
account = CLIENT.accounts.first
# create your campaign
campaign =
campaign.funding_instrument_id =
campaign.daily_budget_amount_local_micro = 1_000_000
brndnblck /
Created October 28, 2015 03:57
Getting Ready for the Twitter Ads API Workshop (Ruby)

Are you setup and ready?

To get the most out of the Twitter Ads API workshop, make sure you come with your laptop ready to go. This workshop relies on your participation and there are just a few things you need to have ready ahead of time to make sure your development environment is setup and ready to go.

1. Install Ruby

For OS X and Unix users:

OS X and most unix-based platforms come ready to go with what you'll need to participate in this workshop. Just make sure you've got Ruby 2.0.0 or higher by running ruby -v from your terminal.

brndnblck /
Last active September 14, 2017 15:58
Script for Resumable Media Uploads to Twitter
function video-upload() {
if [ $# -lt 1 ]; then
echo "[ERROR] Missing required file name."
FILESIZE=$(wc -c "$1" | awk '{print $1}')
printf "[START] Uploading $FILESIZE bytes.\n"
MEDIAID=$(twurl /1.1/media/upload.json -H -d "command=INIT&media_category=amplify_video&media_type=video/mp4&total_bytes=$FILESIZE" | jq .media_id_string | sed 's/\"//g')
split -b 5m $1 twitter-video-
### Keybase proof
I hereby claim:
* I am brblck on github.
* I am brandonblack ( on keybase.
* I have a public key whose fingerprint is 2EFD AA2F 4E0A 4173 57CA 1F1E E08B 003E 6489 7700
To claim this, I am signing this object:
#!/bin/env ruby
# lazy hack from Robert Klemme
module Memory
# sizes are guessed, I was too lazy to look
# them up and then they are also platform
# dependent
REF_SIZE = 4 # ?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.