This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# image unshredder for instagram engineering challenge: | |
# <http://instagram-engineering.tumblr.com/post/12651721845> | |
# | |
# author: @mikedemers <[email protected]> | |
# | |
# t-shirt size: large :) | |
require 'rubygems' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# some credit to https://github.com/maddox/magick-installer | |
require 'formula' | |
def ghostscript_srsly? | |
ARGV.include? '--with-ghostscript' | |
end | |
def ghostscript_fonts? | |
File.directory? "#{HOMEBREW_PREFIX}/share/ghostscript/fonts" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def histogram(h, width=40) | |
max_key_size, max_value = 0, 0 | |
h.each_pair do |k,v| | |
s = k.to_s.size | |
max_key_size = s if s > max_key_size | |
max_value = v if v > max_value | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'aws/s3' | |
bucket = ARGV[0].to_s.strip | |
filepath = ARGV[1].to_s.strip | |
filename = ARGV[2] ? ARGV[2].to_s.strip : File.basename(filepath) | |
AWS::S3::Base.establish_connection!( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BUDIR="/home/mike/backup/db" | |
UN="username" | |
PW="password" | |
DB="database_name" | |
BUCKET="bucket-name" | |
ARCHIVER="/home/mike/backup/bin/archiver.rb" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# TODO: this needs to be updated to work with logrotate... | |
BUDIR="/home/mike/backup/logs" | |
BUCKET="APPNAME-full-logs" | |
ARCHIVER="/home/mike/backup/bin/archiver.rb" | |
GZIP="/bin/gzip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'gmail' | |
require 'fileutils' | |
username = '' | |
password = '' | |
root = Dir.pwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'webrick' | |
include WEBrick | |
# add custom MIME types | |
HTTPUtils::DefaultMimeTypes.store('swf', 'application/x-shockwave-flash') | |
port = rand(1000) + 4000 | |
path = File.expand_path((ARGV[0].nil?) ? File.dirname(__FILE__) : ARGV[0]) |