This file contains hidden or 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/ruby | |
require 'shellwords' | |
require 'thread' | |
paths = Queue.new | |
ARGV.each { |path| paths << path } | |
# http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/FujiFilm.html |
This file contains hidden or 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 | |
# brew install imagemagick | |
# brew install Caskroom/cask/hugin | |
require 'fileutils' | |
require 'thread' | |
require 'optparse' | |
ALIGN_COMMAND_PATH = '/usr/local/Caskroom/hugin/2014.0.0/HuginTools/align_image_stack' |
This file contains hidden or 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
# encoding: utf-8 | |
$: << File.expand_path('../../lib', __FILE__) | |
require 'ione' | |
require 'thread' | |
MESSAGE = 'hello world!' | |
def setup_server(acceptor) |
This file contains hidden or 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
-- Table information like sortkeys, unsorted percentage | |
-- see http://docs.aws.amazon.com/redshift/latest/dg/r_SVV_TABLE_INFO.html | |
SELECT * FROM svv_table_info; | |
-- Table sizes in GB | |
SELECT t.name, COUNT(tbl) / 1000.0 AS gb | |
FROM ( | |
SELECT DISTINCT datname, id, name | |
FROM stv_tbl_perm | |
JOIN pg_database ON pg_database.oid = db_id |
This file contains hidden or 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 | |
# Tested with EMR AMI 3.9.0, but most likely does not work except | |
# in fortuitous constellations of errors | |
failed_task_id=$(zgrep -F 'Task failed' steps/*/syslog.* | head -n 1 | perl -p -e 's/^.*(task_\S+).*$/$1/') | |
failed_task_log=$(zgrep -l -R -F $failed_task_id task-attempts | tail -n 1) | |
failed_attempt_id=$(zgrep -F FATAL $failed_task_log | head -n 1 | perl -p -e 's/^.*(attempt_\S+).*$/$1/') | |
failed_attempt_log=$(zgrep -l -R -F $failed_attempt_id task-attempts | tail -n 1) |
This file contains hidden or 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
sudo ifconfig awdl0 down |
This file contains hidden or 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
def read_sequence_file(path, key_type, value_type) | |
uri = "file://#{File.expand_path(path)}" | |
conf = Hadoop::Conf::Configuration.new | |
fs = Hadoop::Fs::FileSystem.get(java.net.URI.create(uri), conf) | |
path = Hadoop::Fs::Path.new(uri) | |
reader = Hadoop::Io::SequenceFile::Reader.new(fs, path, conf) | |
key = Hadoop::Util::ReflectionUtils.new_instance(reader.key_class, conf) | |
value = Hadoop::Util::ReflectionUtils.new_instance(reader.value_class, conf) | |
while reader.next(key, value) | |
yield key, value |
This file contains hidden or 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 | |
log_group=$1 | |
list_command="aws logs describe-log-streams --log-group-name $log_group" | |
group_next_token='' | |
while true; do | |
if [[ -n $group_next_token ]]; then | |
response=$($list_command --next-token $group_next_token) | |
else |
This file contains hidden or 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
set traffic-policy shaper DOWNLOAD-POLICY | |
set traffic-policy shaper DOWNLOAD-POLICY bandwidth 1000Mbit | |
set traffic-policy shaper DOWNLOAD-POLICY default bandwidth 100% | |
set traffic-policy shaper DOWNLOAD-POLICY default ceiling 100% | |
set traffic-policy shaper DOWNLOAD-POLICY default burst 15k | |
set traffic-policy shaper DOWNLOAD-POLICY default queue-type fair-queue | |
set traffic-policy shaper DOWNLOAD-POLICY class 2 bandwidth 20Mbit | |
set traffic-policy shaper DOWNLOAD-POLICY class 2 burst 15k | |
set traffic-policy shaper DOWNLOAD-POLICY class 2 ceiling 40Mbit |
This file contains hidden or 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 | |
if [[ ! -d .git ]]; then | |
echo 'You must run this command from the root of the repository' 1>&2 | |
exit 1 | |
fi | |
environment=${1:-staging} | |
name=$(basename $PWD | tr - _) |