Skip to content

Instantly share code, notes, and snippets.

View jingoro's full-sized avatar

John Nishinaga jingoro

View GitHub Profile
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
#!/bin/bash
#
# Prerequisites: brew install mpg123 vorbis-tools
for fm in "$@"; do
f="${fm%.mp3}"
if [ "$f" != "$fm" ] && [ -a "$fm" ]; then
mpg123 -w - "$f.mp3" | oggenc -o "$f.ogg" -
fi
done
#!/bin/bash
# dependencies:
# sudo port install sox
TITLE="On the hour..."
MESSAGE="...where are you?"
SOUND="/System/Library/Sounds/Hero.aiff"
PLAY="/usr/bin/afplay"
#!/bin/sh
# Prerequisites:
# sudo port install mpeg4ip
mp4creator -hint=1 "$1"
mp4creator -hint=2 "$1"
mp4creator -optimize "$1"
#!/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
#!/bin/sh
for file in $*; do
advpng -z1 "$file" && optipng -i0 -o7 "$file" && advpng -z4 "$file"
done
#!/bin/sh
for file in $*; do
jpegtran -optimize -progressive -copy none \
"$file" > "$file.tran"
mv -f "$file".tran "$file"
done
@jingoro
jingoro / gist:4039231
Created November 8, 2012 14:50
PHP on Macports
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
@jingoro
jingoro / gist:4029324
Created November 7, 2012 02:54
PDF Tricks
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 \
@jingoro
jingoro / number_convert.rb
Created October 3, 2012 02:58
Number words to number
#!/usr/bin/env rspec
require 'rubygems'
require 'bundler/setup'
require 'rspec'
class Convert
MAPPING = {
# singles