Skip to content

Instantly share code, notes, and snippets.

Russell Brooks iq9

Block or report user

Report or block iq9

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@iq9
iq9 / bash_prompt.sh
Last active Dec 28, 2015
Custom, color-coded OS X prompt to show user & hostname, present directory, and makes your prompt Git-aware, showing active Branch and different single-character codes to indicate Git statuses.
View bash_prompt.sh
#!/bin/bash
# Custom, color-coded OS X prompt to show user & hostname,
# present directory, and makes your prompt Git-aware, showing
# active Branch and different single-character codes to indicate
# Git statuses, eg:
#
# user@host: ~/Dev/foo on master [+!?$]
# $
#
@iq9
iq9 / aac_movies.rb
Created Oct 12, 2013
Traverses a directory tree recursively and lists all MP4 and M4V movies with AAC audio streams. Also lists how many audio channels. I needed to find all movies with AAC 5.1 audio so I could begin to convert them all to AC-3, because Apple TV doesn't support 5.1 AAC.
View aac_movies.rb
#!/usr/bin/env ruby
# Traverses a directory tree recursively and lists all MP4 and M4V movies with AAC audio streams.
# Use: I needed to find all movies with AAC 5.1 audio so I could begin to convert them all to AC-3,
# because Apple TV doesn't support 5.1 AAC.
#
# Dependencies: ffmpeg 1.2+. Really uses ffprobe.
require 'json'
Dir.glob(['**/*.mp4', '**/*.m4v']) do |f|
@iq9
iq9 / coderay_twilight.css
Created Jun 10, 2012
TextMate Twilight Theme for CodeRay Syntax Highlighter
View coderay_twilight.css
/*
TextMate Twilight Theme for CodeRay syntax highlighter.
by: russbrooks.com
*/
.CodeRay {
background-color: #000;
font-family: Monaco, "Courier New", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace;
font-size: 10px;
color: #F8F8F8;
padding: 1em 0px 1em 1em;
@iq9
iq9 / Website Backup
Created Aug 28, 2011
Archives multiple websites, and backs up their PostgreSQL DB's.
View Website Backup
#!/bin/bash
# Script to back up all websites and their DB's to external drive.
#
# Author: Russ Brooks [www.russbrooks.com]
# set -e
if [[ $EUID -ne 0 ]]; then
echo 'This script must be run as Root.' 1>&2
@iq9
iq9 / gist:1147826
Created Aug 15, 2011
FFmpeg Cheatsheet
View gist:1147826
# Trim video to first 30 seconds, without transcoding.
ffmpeg -i source.mkv -c:v copy -c:a copy -ss 00:00:00 -t 00:00:30 dest.mkv
@iq9
iq9 / "Throw a Backtrace" to logs
Created Jun 13, 2011
"Throw a Backtrace" to logs, when you can't see your backtrace in the browser [like with background processing]:
View "Throw a Backtrace" to logs
begin
# Code you are debugging
rescue Exception => ex
logger = Logger.new('/var/log/debug.log')
logger.error("trace: #{ex.backtrace().join("\n")}")
end
@iq9
iq9 / Realtime eth0 Bandwidth
Created Feb 15, 2011
Realtime Bandwidth Consumption on Ethernet Port 0 on Linux
View Realtime eth0 Bandwidth
#!/bin/bash
if [ -z "$1" ]; then
echo
echo usage: $0 network-interface
echo
echo e.g. $0 eth0
echo
exit
fi
@iq9
iq9 / Monitor FTP Traffic in Real Time
Created Mar 2, 2010
Monitor FTP Traffic in Real Time
View Monitor FTP Traffic in Real Time
tcpdump -i en0 -n port ftp && port ftp-data
View Log All HTTP Traffic - *nix
tcpdump port 80 -n -i any -w /var/log/http_dump.log -p -C 10 -W 5 -s 1500
@iq9
iq9 / Delete .svn Files Recursively
Created Mar 2, 2010
Delete .svn Files Recursively
View Delete .svn Files Recursively
rm -rf `find . -type d -name .svn`
You can’t perform that action at this time.