Skip to content

Instantly share code, notes, and snippets.

View jamiew's full-sized avatar

Jamie Dubs jamiew

View GitHub Profile
@larsyencken
larsyencken / fetch_and_combine.py
Created November 15, 2012 03:09
Aggregating CloudFront logs
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# fetch_and_combine.py
#
"""
Scans CloudFront logs in an S3 bucket for any that are new. Combines log files
into a single local file per hour. If logs for multiple CloudFront
distributions are present, combines them all.
@ndbroadbent
ndbroadbent / deploy.rake
Created September 28, 2012 22:18
Rake task for precompiling assets locally before deploying to Heroku
require 'fileutils'
# Warning: The following deploy task will completely overwrite whatever is currently deployed to Heroku.
# The deploy branch is rebased onto master, so the push needs to be forced.
desc "Deploy app to Heroku after precompiling assets"
task :deploy do
deploy_branch = 'heroku'
remote = 'heroku'
deploy_repo_dir = "tmp/heroku_deploy"
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active March 27, 2024 06:33
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@shunchu
shunchu / convert-seconds-into-hh-mm-ss-in-ruby.rb
Created July 25, 2012 07:58
Convert seconds into HH:MM:SS in Ruby
t = 236 # seconds
Time.at(t).utc.strftime("%H:%M:%S")
=> "00:03:56"
# Reference
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time
@apeckham
apeckham / gist:2886678
Created June 7, 2012 04:57
run Handbrake on a batch of files, listed as arguments
#!/bin/sh -e
for i in "$@"; do
HandBrakeCLI -i "$i" -o "${i%.*}-ipad.mp4" --preset="iPad"
done
@kylemcdonald
kylemcdonald / scratchml.xml
Created January 22, 2012 23:19 — forked from jamiew/scratchml.xml
ScratchML draft spec v3
<sml>
<!--
# SCRATCH MARKUP LANGUAGE, WORKING DRAFT
http://scratchml.com
* version -- minor versions for small changes, major for incompatibilities
* info -- general file metadata: author info, client info etc.
* turntable - hardware metadata
* mixer -- hardware metadata
@apeckham
apeckham / .gitignore
Created January 18, 2012 20:28
node duplicating proxy
node_modules
@hwatkins
hwatkins / ratings.rb
Created December 2, 2011 23:15
A script to use the Netflix paginated "What You've Rated" to pull what you have rated in Netflix. This call is not exposed in the Netflix API so it's hard to get any other way. This is quick and dirty so not the best Ruby constructs.
#!/usr/bin/env ruby
require 'iconv'
require 'nokogiri'
# This is a simple script to spider your Netflix paginated "What You've Rated" list.
# It requires an OS X based system with Ruby 1.9+, Safari, and AppleScript
#
# I could not find a way to back up my ratings (for all titles, not just my rental activity)
# without registering for a Netflix API key or handing my Netflix credentials over to someone
# who had an API key, so I decided to take a brute force approach and just parse the HTML for
@hotchpotch
hotchpotch / unicorn_killer.rb
Created October 3, 2011 08:11
Unicorn process killer utility
# # your config.ru
# require 'unicorn_killer'
# use UnicornKiller::MaxRequests, 1000
# use UnicornKiller::Oom, 400 * 1024
module UnicornKiller
module Kill
def quit
sec = (Time.now - @process_start).to_i
warn "#{self.class} send SIGQUIT (pid: #{Process.pid})\talive: #{sec} sec"
@lcapaldo
lcapaldo / vhxenq.pl
Created September 19, 2011 00:14
Irssi script for automatically queueing video links to VHX.tv
use strict;
use Irssi;
use URI::Find::Rule;
use REST::Client;
use URI::Escape;
use vars qw($VERSION %IRSSI);
$VERSION = '0.01';
%IRSSI = (