Skip to content

Instantly share code, notes, and snippets.

View baxang's full-sized avatar

Sanghyun Park baxang

  • Jora
  • Sydney, Australia
View GitHub Profile
ssh_user = "[email protected]" # for rsync deployment
remote_root = "~/path/to/remote/" # for rsync deployment
namespace :styles do
desc "Clear styles"
task :clear do
puts "*** Clearing styles ***"
system "rm -Rfv css/*"
end
desc "Generate styles"
@baxang
baxang / uploader_fu.rb
Created August 30, 2011 01:59 — forked from charly/uploader_fu.rb
a nice little module to help migrate from attachment_fu to carrierwave
# Helps you migrate from attachment_fu
# put it in your /lib dir and include it your xxxx_uploader.rb
module UploaderFu
def partition_dir
("%08d" % model.id).scan(/\d{4}/).join("/")
end
def model_dir
"#{model.class.to_s.underscore}/#{mounted_as}/"
@baxang
baxang / dart.txt
Created September 19, 2011 06:33 — forked from paulmillr/dart.md
Google dart email
---------- Forwarded message ----------
From: Mark S. Miller <[email protected]>
Date: Tue, Nov 16, 2010 at 3:44 PM
Subject: "Future of Javascript" doc from our internal "JavaScript Summit"
last week
To: [email protected]
On November 10th and 11th, a number of Google teams representing a variety
of viewpoints on client-side languages met to agree on a common vision for
the future of Javascript.
@baxang
baxang / gist:1308661
Created October 24, 2011 09:27 — forked from Aslan/gist:536379
set daemon 30 # with start delay 30
set mailserver localhost # sudo apt-get install postfix
set mail-format { from: [email protected] }
set alert [email protected]
set logfile /var/log/monit.log
check process redis-server with pidfile /var/run/redis.pid
start program = "/usr/local/bin/redis-server /data/redis/redis.conf"
stop program = "/usr/bin/killall -9 redis-server"
if totalmem is greater than 500.0 MB for 5 cycles then alert
if cpu is greater than 80% for 5 cycles then alert
@baxang
baxang / gist:1308662
Created October 24, 2011 09:27 — forked from dipolesource/gist:1265576
Log Juggernaut via Monit
check host juggernaut with address 127.0.0.1
start program = "/bin/bash -c '2>&1 1>>/home/deploy/juggernaut.log /usr/local/bin/node /usr/local/lib/node_modules/juggernaut/server.js'"
stop program = "/bin/kill -9 $(pidof node);/bin/kill -9 $(pgrep -f 'bash -c 2>&1 1>>/home/deploy/juggernaut.log')"
if failed port 8080 protocol HTTP
request /application.js
with timeout 10 seconds
then restart
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@baxang
baxang / gist:1395787
Created November 26, 2011 14:39
nginx init.d script
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@baxang
baxang / fastcgi_params
Created March 22, 2012 18:01
Nginx configuration for Wordpress 3.3.1
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
@baxang
baxang / smi2srt.py
Created April 3, 2012 17:42
convert script in SMI to SRT format
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@package smi2srt
@brief this module is for convert .smi subtitle file into .srt subtitle
(Request by Alfred Chae)
Started : 2011/08/08
license: GPL
@baxang
baxang / rvm2rbenv.txt
Created May 16, 2012 12:50 — forked from brentertz/rvm2rbenv.txt
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################