Skip to content

Instantly share code, notes, and snippets.

John Nishinaga jingoro

Block or report user

Report or block jingoro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:5674640
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
View mp32ogg
#!/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
View chime
#!/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"
View mp4hint
#!/bin/sh
# Prerequisites:
# sudo port install mpeg4ip
mp4creator -hint=1 "$1"
mp4creator -hint=2 "$1"
mp4creator -optimize "$1"
View m2pdf
#!/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
View cpng
#!/bin/sh
for file in $*; do
advpng -z1 "$file" && optipng -i0 -o7 "$file" && advpng -z4 "$file"
done
View cjpg
#!/bin/sh
for file in $*; do
jpegtran -optimize -progressive -copy none \
"$file" > "$file.tran"
mv -f "$file".tran "$file"
done
View gist:4039231
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
View gist:4029324
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 Oct 3, 2012
Number words to number
View number_convert.rb
#!/usr/bin/env rspec
require 'rubygems'
require 'bundler/setup'
require 'rspec'
class Convert
MAPPING = {
# singles
You can’t perform that action at this time.