Skip to content

Instantly share code, notes, and snippets.

View tessro's full-sized avatar

Tess Rosania tessro

View GitHub Profile
code = %q{Nputs "code = %q{#{code}}"NNcode.chars.each do |c|N if c > 'M' && c < 'O'N putsN elseN print cN endNendNNputs}
puts "code = %q{#{code}}"
code.chars.each do |c|
if c > 'M' && c < 'O'
puts
else
print c
end
@tessro
tessro / pngbai
Created October 21, 2011 19:23
A badass command line PNG compressor
#!/bin/sh
## Packages:
# brew install pngcrush
# brew install optipng
# brew install advancecomp
# brew install https://raw.github.com/adamv/homebrew-alt/23f9084410476da1fcaf946f24f4dde47fe888ea/non-free/pngout.rb
function usage {
echo "Usage: $0 infile outfile"
#!/bin/sh
## Packages:
# brew install pngcrush
# brew install optipng
# brew install advancemame
# brew install https://raw.github.com/adamv/homebrew-alt/23f9084410476da1fcaf946f24f4dde47fe888ea/non-free/pngout.rb
function usage {
echo "Usage: $0 infile outfile"
@tessro
tessro / broken.m
Created October 21, 2011 18:36
BTW, this math is wrong
// Compress further via advpng on level 1 – 4.
// (level can normally range from 1 – 7)
levelStr = [NSString stringWithFormat:@"-z%d", (level < 5 ? 1 : level - 3)];
@tessro
tessro / crawl.sh
Created October 20, 2011 20:49
Given a list of Twitter handles (one per line), output a list of values for a given profile field
#!/bin/sh
function usage {
echo "usage: $0 source_file field"
exit 1
}
if [ ! $# -eq 2 ]; then
usage
elif [ ! -f $1 ]; then
#!/bin/sh
# setup-xp.sh - Install and configure IE Application Compatibility images in VirtualBox
#
# Some parts from: http://www.peculier.com/blog/create-ie-vbox.html
## Prerequisites:
#
# - VirtualBox 4.0+
# - unrar (`brew install unrar`)
# - 7zip (`brew install 7zip`)
#!/bin/sh
### BEGIN INIT INFO
# Provides: example_app
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the example_app app server
# Description: starts the example_app app server
@tessro
tessro / deploy.rb
Created May 15, 2010 21:15
Capistrano deployment script for JRuby/GlassFish gem.
set :application, "example_app"
set :domain, "example-app.com"
## IMPORTANT: "true" prevents the server from booting properly
## This line is sometimes recommended in other Capistrano configurations,
## but do not use it for GlassFish.
# default_run_options[:pty] = true
set :scm, :git
set :repository, "git@github.com:paulrosania/example_app.git"
#!/bin/sh
### BEGIN INIT INFO
# Provides: [app]
# Required-Start: $local_fs $remote_fs $network $syslog $nginx $mysql
# Required-Stop: $local_fs $remote_fs $network $syslog $nginx $mysql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the [app] app server
# Description: starts the [app] app server
@tessro
tessro / redis-server
Created December 16, 2009 14:20
A CentOS initscript for Redis
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid