Skip to content

Instantly share code, notes, and snippets.

View brndnblck's full-sized avatar
🎧

Brandon Black brndnblck

🎧
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/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 # ?
OBJ_OVERHEAD = 4 # ?
### Keybase proof
I hereby claim:
* I am brblck on github.
* I am brandonblack (https://keybase.io/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:
@brndnblck
brndnblck / video_upload.sh
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."
else
FILESIZE=$(wc -c "$1" | awk '{print $1}')
printf "[START] Uploading $FILESIZE bytes.\n"
MEDIAID=$(twurl /1.1/media/upload.json -H upload.twitter.com -d "command=INIT&media_category=amplify_video&media_type=video/mp4&total_bytes=$FILESIZE" | jq .media_id_string | sed 's/\"//g')
INDEX=0
split -b 5m $1 twitter-video-
@brndnblck
brndnblck / workshop.md
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
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 = TwitterAds::Campaign.new(account)
campaign.funding_instrument_id = account.funding_instruments.first.id
campaign.daily_budget_amount_local_micro = 1_000_000
@brndnblck
brndnblck / Blockstack
Created November 17, 2016 18:11
Blockstack Verification
Verifying that "brblck.id" is my Blockstack ID. https://onename.com/brblck
@brndnblck
brndnblck / GPG and git on macOS.md
Created April 6, 2017 05:02 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  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
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/127.0.0.1" > /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
brndnblck / recovery.sh
Last active October 31, 2019 18:25 — forked from jonathantneal/recovery.sh
Create or update macOS Mojave Recovery Partition Without Reinstalling
#!/bin/sh
# Set the macOS installer path as a variable
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
MOUNT_POINT="$MACOS_INSTALLER/Contents/SharedSupport"
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\""