Skip to content

Instantly share code, notes, and snippets.

View chris-erickson's full-sized avatar

Chris Erickson chris-erickson

View GitHub Profile
@chris-erickson
chris-erickson / transcode_br_rip.sh
Created March 12, 2017 20:03
Start from a Blu-ray rip (mkv format, out of MakeMKV) and properly convert to a nice mkv
# Start by importing with MakeMKV
# Make sure to at least pick the "forced" subtitles - these are usually helpful ones for us dummies who don't speak more than one language
# Subtitles are weird and need to be burned in, so you have to later select them, and only picking the one you need makes this easier.
# Update the tools
gem update video_transcoding
brew upgrade
# Get the command by checking for cropping first
detect-crop <filename>
@chris-erickson
chris-erickson / ripitgood.sh
Last active January 16, 2017 03:29
Use youtube-dl to rip the highest quality video and audio
youtube-dl https://www.youtube.com/watch?v=udrKnXueTW0 -F
#[youtube] udrKnXueTW0: Downloading webpage
#[youtube] udrKnXueTW0: Downloading video info webpage
#[youtube] udrKnXueTW0: Extracting video information
#[youtube] udrKnXueTW0: Downloading MPD manifest
#[info] Available formats for udrKnXueTW0:
#format code extension resolution note
#249 webm audio only DASH audio 55k , opus @ 50k (48000Hz), 19.80MiB
#250 webm audio only DASH audio 76k , opus @ 70k (48000Hz), 24.55MiB
#171 webm audio only DASH audio 84k , vorbis@128k (44100Hz), 30.21MiB
@chris-erickson
chris-erickson / filter.re
Created January 13, 2017 19:07
Block CSP warnings in Chrome, helpful for working with a site that is reporting, but not enforcing errors
^((?!Report).)*$
@chris-erickson
chris-erickson / concatenate.sh
Created January 3, 2017 02:48
Merge (concatenate) multiple media files that share the same codecs
# Update the extensions to match whatever you are starting with
# It isn't critical, but makes things work properly
for f in *.mp4; do echo "file '$f'" >> mylist.txt; done
ffmpeg -f concat -i mylist.txt -c copy output.mp4
@chris-erickson
chris-erickson / check_ssl_cert_validity.sh
Created November 28, 2016 04:49
Checks a domain for SSL cert validity
#!/bin/sh
# Original source: http://superuser.com/a/620188/561192
# A few modifications to send an email and potentially account for running on linux
DEBUG=false
warning_days=29 # Number of days to warn about soon-to-expire certs
certs_to_check='google.com:443
www.apple.com:443'
@chris-erickson
chris-erickson / load_users_in_django.py
Created November 23, 2016 15:01
A really hacky way to load a bunch of users through the shell instead of writing something more complicated.
# This is just a really hacky way to load a bunch of users through the shell instead of writing something more complicated.
# Intructions: Paste it in line by line!
names = [
["FirstName", "LastName", "something@email.com", "username", "a-password-here"],
["FirstName", "LastName", "something@email.com", "username", "a-password-here"],
]
FNAME = 0
LNAME = 1
EMAIL = 2
@chris-erickson
chris-erickson / network_status.sh
Created July 31, 2016 18:21
This just prints the ethernet link status to the console every 1 second
#! /bin/bash
while :
do
# Update the interface as needed
ifconfig en9 | grep media | tr -d '\t'
# Update the delay as needed (seconds)
sleep 1
done
@chris-erickson
chris-erickson / get-jira-branchname.js
Last active August 29, 2015 14:25
Something dumb to make getting JIRA branchnames faster.
var selectedIssue = document.querySelectorAll(".ghx-selected")[0];
var key = selectedIssue.dataset.issueKey;
var description = selectedIssue.childNodes[0].childNodes[0].childNodes[2].title;
var text = key + '-' + description;
var MAX_LENGTH = 35;
var slug = text.replace(/\s+/g, '-').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '-').replace(/^-+/, '').replace(/-+$/, '').substring(0, MAX_LENGTH);
window.prompt("Copy this!", 'git checkout -b \'' + slug + '\'');
@chris-erickson
chris-erickson / gist:18d2dffe5d88ae7de222
Created June 5, 2014 14:30
A helper to run the homebrew updater
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.zerowidth.launched.homebrew_updater</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
@chris-erickson
chris-erickson / millertime
Last active November 7, 2015 21:42
A helper to notify you when you have brews ready to update
#!/bin/bash
# This script runs the homebrew updater, then reports if any of your packages are out of date
# Generally, this should be run automatically using a launchctl task (see end of file for an example)
#
# In addition, you might want to change the notification style to be an "alert" so it hangs around a while.
# This can be done in System Preferences -> Notification Center (look for homebrew-notifier)
#
# Requires:
# - Homebrew
# - terminal-notifier (brew install terminal-notifier)