Skip to content

Instantly share code, notes, and snippets.

@samqiu
samqiu / VladGh.com-LEMP-install-log
Created May 14, 2011 10:17
VladGh.com-LEMP-install-log
Ign http://cn.archive.ubuntu.com natty InRelease
Ign http://cn.archive.ubuntu.com natty-updates InRelease
Hit http://cn.archive.ubuntu.com natty Release.gpg
Hit http://cn.archive.ubuntu.com natty-updates Release.gpg
Hit http://cn.archive.ubuntu.com natty Release
Hit http://cn.archive.ubuntu.com natty-updates Release
Ign http://archive.canonical.com natty InRelease
Ign http://extras.ubuntu.com natty InRelease
Hit http://cn.archive.ubuntu.com natty/main Sources
Hit http://cn.archive.ubuntu.com natty/restricted Sources
@samqiu
samqiu / nginx.conf
Created September 15, 2011 01:07 — forked from huacnlee/nginx.conf
Nginx http proxy cache to mirror of Rubygems.org
# 在本地服务器建立 rubygems.org 的镜像缓存,以提高 gem 的安装速度
# 此配置设置缓存过期为1天,也就是说,新上的 gem 无法马上安装
# 做这个起什么作用?
# rubygems 的很多资源文件是存放到 Amazon S3 上面的,由于 GFW 对某些 S3 服务器又连接重置或丢包,导致 gem 安装异常缓慢或有时候根本无法连接安装。
# 而通过这种跳板的方式可以很好的解决这个问题,当然前提是 Nginx反向代理 服务器需要在国外
proxy_cache_path /var/cache/rubygems levels=1:2 keys_zone=RUBYGEMS:10m
inactive=24h max_size=1g;
server {
listen 80;
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set expandtab " convert tabs to spaces
@samqiu
samqiu / railscasts.rb
Last active December 9, 2022 03:49
Download free Railscast video
#!/usr/bin/ruby
require 'rss'
# Usage
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/
# episodes.rss
# OR
# $ ./railscasts.rb
p 'Downloading rss index'
@samqiu
samqiu / gist:1504240
Created December 21, 2011 02:11
哪个更快
SELECT * FROM `post` WHERE `status` != 'inherit' AND `status` != 'auto-draft';
SELECT * FROM `post` WHERE `status` NOT IN ('inherit', 'auto-draft');
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Example aliases
@samqiu
samqiu / railscast
Created February 27, 2013 09:12
Railscast
http://media.railscasts.com/assets/episodes/videos/001-caching-with-instance-variables.mp4
http://media.railscasts.com/assets/episodes/videos/002-dynamic-find-by-methods.mp4
http://media.railscasts.com/assets/episodes/videos/003-find-through-association.mp4
http://media.railscasts.com/assets/episodes/videos/004-move-find-into-model.mp4
http://media.railscasts.com/assets/episodes/videos/005-using-with-scope.mp4
http://media.railscasts.com/assets/episodes/videos/006-shortcut-blocks-with-symbol-to-proc.mp4
http://media.railscasts.com/assets/episodes/videos/007-all-about-layouts.mp4
http://media.railscasts.com/assets/episodes/videos/008-layouts-and-content-for.mp4
http://media.railscasts.com/assets/episodes/videos/009-filtering-sensitive-logs.mp4
http://media.railscasts.com/assets/episodes/videos/010-refactoring-user-name-part-1.mp4
@samqiu
samqiu / .zshrc
Created April 28, 2013 02:27 — forked from SlexAxton/.zshrc
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@samqiu
samqiu / swap.sh
Created July 9, 2013 03:32
find-out-what-is-using-your-swap.sh
#!/bin/bash
# find-out-what-is-using-your-swap.sh
# -- Get current swap usage for all running processes
# --
# -- rev.0.3, 2012-09-03, Jan Smid - alignment and intendation, sorting
# -- rev.0.2, 2012-08-09, Mikko Rantalainen - pipe the output to "sort -nk3" to get sorted output
# -- rev.0.1, 2011-05-27, Erik Ljungstrom - initial version
SCRIPT_NAME=`basename $0`;
@samqiu
samqiu / RubyConfChina.geojson
Last active December 21, 2015 22:38
RubyConfChina 2013 开始接受报名和售票!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.