Skip to content

Instantly share code, notes, and snippets.

@mrichie
mrichie / sohu_mirrors
Last active Dec 19, 2015
sohu ubuntu mirrors
View sohu_mirrors
deb http://mirrors.sohu.com/ubuntu/ precise main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
@mrichie
mrichie / gist:5371841
Created Apr 12, 2013
merge debug framework and release framework
View gist:5371841
# Set the target folders and the final framework product.
INSTALL_DIR=~/Desktop/EDoc
DEVICE_DIR=~/Desktop/1EDocWidget.framework
SIMULATOR_DIR=~/Desktop/2EDocWidget.framework
# Create and renews the final product folder.
mkdir -p "${INSTALL_DIR}"
# Copy the header files to the final product folder.
ditto "${DEVICE_DIR}/Headers" "${INSTALL_DIR}/Headers"
View gist:4630850
require "vcr"
require "net/http"
VCR.configure do |c|
c.cassette_library_dir = '/tmp'
c.hook_into :webmock
c.default_cassette_options = {
record: :once
}
View gist:4367339
if [ "$(id -u)" -eq "0" ]; then
echo "This script should not be run as root"
exit 1
fi
sudo ntpdate ntp.ubuntu.com
sudo apt-get install gcc -y
sudo apt-get install language-pack-zh-hant language-pack-zh-hans -y
sudo apt-get install yasm imagemagick ghostscript libsasl2-dev libmemcached-dev -y
@mrichie
mrichie / unicorn
Created Nov 20, 2012 — forked from shapeshed/unicorn
Unicorn / Monit setup
View unicorn
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/path/to/your/app/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENVIRONMENT=production
@mrichie
mrichie / gist:4043266
Created Nov 9, 2012 — forked from jfirebaugh/gist:4007524
Installing Ruby 2.0.0-preview1 with RVM on OS X
View gist:4043266
# First, make sure that you have the most recent rvm. Several bugs with 2.0.0-preview1
# have recently been fixed.
#
# Second, the openssl that comes with MacOS is too old for Ruby 2.0. You need to install
# a newer one with homebrew or the rvm pkg command.
# Option 1, with homebrew openssl:
brew update
brew install openssl
@mrichie
mrichie / Gemfile
Created Oct 30, 2012 — forked from HungYuHei/Gemfile
followable with redis Sorted-Set
View Gemfile
# Gemfile
gem 'redis', '~> 3.0.1'
View MongoDB Backup Script
#!/bin/bash
#!/usr/bin/env ruby
#########################################
# Define source and destinations
MONGO_DBS=""
BACKUP_TMP=~/tmp
BACKUP_DEST=~/backups
MONGODUMP_BIN=/Users/wahyusumartha/Documents/mongodb-db/bin/mongodump
TAR_BIN=/usr/bin/tar
View automongobackup.sh
#!/bin/bash
#
# MongoDB Backup Script
# VER. 0.1
# Note, this is a lobotomized port of AutoMySQLBackup
# (http://sourceforge.net/projects/automysqlbackup/) for use with
# MongoDB.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@mrichie
mrichie / activeadmin-cancan.rb
Created Jul 9, 2012
Deep integration of CanCan into ActiveAdmin
View activeadmin-cancan.rb
# blog post:
# Before using this initializer, you must set up Cancan. First, add the gem to your Gemfile:
#
# gem 'cancan'
#
# Next, generate and edit an Ability class:
#
# rails generate cancan:ability
#