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
require 'rubygems' | |
require 'bundler/setup' | |
require 'mongoid' | |
Mongoid.configure do |config| | |
config.master = Mongo::Connection.new('localhost', 27017, :logger => nil).db('mongoid-test') | |
end | |
class A | |
include Mongoid::Document |
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 'rational' | |
require 'bigdecimal' | |
PI = BigDecimal.new(" | |
3.141592653589793238462643383279502884197169399375105820974944592307816406286 | |
208998628034825342117067982148086513282306647093844609550582231725359408128481 | |
117450284102701938521105559644622948954930381964428810975665933446128475648233 | |
786783165271201909145648566923460348610454326648213393607260249141273724587006 |
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 | |
# | |
# http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ffx/ffx-spec.pdf | |
# http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ffx/ffx-spec2.pdf | |
# http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ffx/ffx-ad-VAES3.pdf | |
require 'openssl' | |
def radix_block_prepend(radix, n, block) |
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 rspec | |
require 'rubygems' | |
require 'bundler/setup' | |
require 'rspec' | |
class Convert | |
MAPPING = { | |
# singles |
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
for f in *.pdf; do | |
echo "Extracting first page of $f..." | |
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \ | |
-dFirstPage=1 -dLastPage=1 \ | |
-sOutputFile="${f}_first.pdf" \ | |
"$f" | |
done | |
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \ | |
-sOutputFile=Combined.pdf \ |
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
sudo port install apache2 php5 php5-gd php5-curl php5-openssl php5-mbstring | |
# php5-gmp php5-iconv php5-mcrypt php5-posix | |
cd /opt/local/etc/php5 | |
sudo cp php.ini-development php.ini | |
# set mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket to /opt/local/var/run/mysql5/mysqld.sock | |
cd /opt/local/apache2/conf |
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/sh | |
for file in $*; do | |
jpegtran -optimize -progressive -copy none \ | |
"$file" > "$file.tran" | |
mv -f "$file".tran "$file" | |
done |
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/sh | |
for file in $*; do | |
advpng -z1 "$file" && optipng -i0 -o7 "$file" && advpng -z4 "$file" | |
done |
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 python | |
# prerequisites | |
# sudo easy_install markdown | |
# install https://code.google.com/p/wkhtmltopdf/ | |
WKHTMLTOPDF_PATH = "/usr/local/bin/wkhtmltopdf" | |
import sys, os, subprocess, re, urllib, tempfile | |
import markdown |
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/sh | |
# Prerequisites: | |
# sudo port install mpeg4ip | |
mp4creator -hint=1 "$1" | |
mp4creator -hint=2 "$1" | |
mp4creator -optimize "$1" |