Skip to content

Instantly share code, notes, and snippets.

View chikaram's full-sized avatar

Chikara (Riki) Miyake chikaram

  • Ho Chi Minh City, Vietnam
View GitHub Profile
wget http://cdni.wired.co.uk/1240x826/g_j/hiroshi1.jpg && osascript -e 'tell application "Finder" to set desktop picture to POSIX file "'`pwd`'/hiroshi1.jpg"'
echo "scale=2; `history | grep 'git blame' | wc -l` * 100 / `history | grep 'git ' | wc -l`" | bc | sed 's/$/%/'
$ rake routes
Prefix Verb URI Pattern Controller#Action
books GET /books(.:format) books#index
POST /books(.:format) books#create
new_book GET /books/new(.:format) books#new
edit_book GET /books/:id/edit(.:format) books#edit
book GET /books/:id(.:format) books#show
PATCH /books/:id(.:format) books#update
PUT /books/:id(.:format) books#update
DELETE /books/:id(.:format) books#destroy
rake routes | grep -v PUT | gsed -e 's/^.* \(Verb\|GET\|POST\|PATCH\|DELETE\)/\1 /g' -e 's/(.:format)/ /g' -e 's/ {:format=>.*}//g' -e 's/Pattern \{8\}/Pattern/g' -e 's/ \/ \{8\}/ \//'
<% 1000.times do |n| %>
user_<%= n %>:
username: <%= "user#{n}" %>
email: <%= "user#{n}@example.com" %>
<% end %>
default: &default
name: name
email: email
column_a: column_a
column_b: column_b
column_c: column_c
column_d: column_d
column_e: column_e
fred:
pdftk file1.pdf file2.pdf file3.pdf output all.pdf
pdftk `curl http://guides.rubyonrails.org/ | grep '<dt><a href' | gsed 's/.*href="\(.*\).html".*/\1.pdf/g'` output RailsGuides.pdf
for i in `curl http://guides.rubyonrails.org/ | grep '<dt><a href' | gsed 's/.*href="\(.*\).html".*/\1.html/g'`
do
URL=http://guides.rubyonrails.org/$i; curl $URL | gsed -e '3i <base href="'$URL'">' -e 's/"\(topNav\|header\)"/"\1" style="display:none"/g' | wkhtmltopdf - `basename $URL .html`.pdf
done
URL=http://guides.rubyonrails.org/getting_started.html; curl $URL | gsed -e '3i <base href="'$URL'">' -e 's/"\(topNav\|header\)"/"\1" style="display:none"/g' | wkhtmltopdf - `basename $URL .html`.pdf