Skip to content

Instantly share code, notes, and snippets.

View JeffWaltzer's full-sized avatar

Jeff Waltzer JeffWaltzer

View GitHub Profile
#!/bin/bash
# Put this in your ~/.git/hooks folder to auto add branch name to git commit messages.
#
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2> /dev/null | grep -oE "[A-Z]+-[0-9]+")
if [ -n "$BRANCH_NAME" ]; then
if ! grep -q "$BRANCH_NAME" $1 ; then
echo -en "[$BRANCH_NAME] " | cat - "$1" > /tmp/out && mv /tmp/out "$1"
fi
fi
@JeffWaltzer
JeffWaltzer / tvise.rb
Last active October 25, 2023 14:31
Script for organizing TV shows
#!/usr/bin/ruby
require 'fileutils'
NO_MOVE_LIST=%w{.directory}
def cleanit(s)
s =s.split('/')[-1]
sub =s.split(/(s[0-9])|([0-9]+of)|([0-9]+x[0-9]+)|(201[0-9])|([0-9]{3})/i)
show_name = sub[0]
if show_name.size > 1
@cheenu
cheenu / netflix_api_sample_signed_request.rb
Last active November 2, 2022 06:22
How to generate an OAuth signature for the Netflix API using Ruby
## This gist is intended to provide a code example for the
# 'Making Signed Requests' section of the 'Authentication Overview' document.
# (http://developer.netflix.com/docs/Security).
#
# We are going to make a catalog request. The hardest part of
# it is figuring out how to generate the oauth_signature.
require 'cgi'
require 'base64'
require 'openssl'