Skip to content

Instantly share code, notes, and snippets.

View rainux's full-sized avatar

Rainux Luo rainux

View GitHub Profile
#!/bin/bash
# Build docs for current package and all explicit dependencies
package=$(basename $(pwd))
if [[ -z $1 ]]
then
packages=$(cargo metadata --format-version 1 | jq -r " .packages | .[] | select(.name == \"$package\") | .dependencies | map(.name) | join(\" \")")
else
@rainux
rainux / deploy.rake
Created July 26, 2012 09:34 — forked from njvitto/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
# Deploy and rollback on Heroku in staging and production
task deploy_staging: ['deploy:set_staging_app', 'deploy:push_staging', 'deploy:restart', 'deploy:tag']
task deploy_production: ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task staging_migrations: [:set_staging_app, :push_staging, :off, :migrate, :restart, :on, :tag]
task staging_rollback: [:set_staging_app, :off, :push_previous, :restart, :on]
@rainux
rainux / gist:2959037
Created June 20, 2012 09:31
The performance impact of LVM snapshot
rainux@kerrigan ~
% YUKI.N> bonnie++
Writing with putc()...done
Writing intelligently...done
Rewriting...done
Reading with getc()...done
Reading intelligently...done
start 'em...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
@rainux
rainux / .vimrc
Created February 2, 2012 08:47 — forked from sikachu/.vimrc
" Highlight Ruby 1.8.x hash rocket
" This will prevent us to ever write it again
highlight ObsoleteHashRocket ctermbg=red guibg=red
au ColorScheme * highlight ObsoleteHashRocket guibg=red
au BufEnter * match ObsoleteHashRocket /\(:\w\+\s*\)\@<==>/
au InsertEnter * match ObsoleteHashRocket /\(:\w\+\s*\)\@<==>/
au InsertLeave * match ObsoleteHashRocket /\(:\w\+\s*\)\@<==>/
@rainux
rainux / build_sdoc.rb
Created February 24, 2011 19:00
Build gems docs with sdoc
#!/usr/bin/env ruby
require 'fileutils'
require 'tmpdir'
Gems = %w(factory_girl rspec-core capybara remarkable remarkable_activerecord)
output_dir = Dir.pwd
Dir.mktmpdir do |tmpdir|
require 'rubygems'
require 'eventmachine'
require 'twitter/json_stream'
module Twitter
class JSONStream
def unbind
# The override just added a call to puts
puts '==unbind'
receive_line(@buffer.flush) unless @buffer.empty?
@rainux
rainux / ree 1.8.7 result
Created January 27, 2011 19:12
Ruby string operation benchmark
rainux@immortal ~/devel/twi_meido
% YUKI.N> ruby d.rb
user system total real
0.770000 0.020000 0.790000 ( 0.802016)
0.730000 0.000000 0.730000 ( 0.740943)
0.760000 0.020000 0.780000 ( 0.793928)
user system total real
1.160000 0.010000 1.170000 ( 1.182798)
1.230000 0.030000 1.260000 ( 1.268377)
@rainux
rainux / gist:771602
Created January 9, 2011 11:07
CyanogenMod 6 adb logcat for IP Webcam
V/network ( 4846): server started
W/CameraSwitch( 4846): open main camera
W/CameraSwitch( 4846): no file - can't switch camera
D/CameraService( 1354): CameraService::connect E (pid 4846, client 0x7dc88)
D/CameraService( 1354): Client::Client E (pid 4846)
D/QualcommCameraHardware( 1354): createInstance: E
D/QualcommCameraHardware( 1354): Storing the current target type as 2
D/QualcommCameraHardware( 1354): constructor EX
D/QualcommCameraHardware( 1354): startCamera E
@rainux
rainux / packages
Created September 27, 2010 21:55
My favorite Arch Linux packages
anthy
chmsee
chromium
cmus
colordiff
colorgcc
ctags
evince
fam
ffmpeg