Skip to content

Instantly share code, notes, and snippets.

@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'
@noahhendrix
noahhendrix / api.rb
Created December 22, 2011 09:38
Authenticating with Grape
module Todo
class API < Grape::API
use Rack::Session::Cookie
version 'v1', :format => :json
helpers do
def current_user
return nil if env['rack.session'][:user_id].nil?
@current_user ||= User.get(env['rack.session'][:user_id])
end
@xream
xream / dnsmasq.conf
Created December 30, 2011 00:47
dnsmasq conf of apple services
#apple
#nslookup -vc a1.phobos.apple.com 168.95.1.1
#203.78.36.42 203.69.138.18
#jp 120.29.145.9 124.40.51.32 61.213.183.25
address=/a1.mzstatic.com/203.69.138.18
address=/a2.mzstatic.com/203.69.138.18
address=/a3.mzstatic.com/203.69.138.18
address=/a4.mzstatic.com/203.69.138.18
address=/a5.mzstatic.com/203.69.138.18
address=/a6.mzstatic.com/203.69.138.18
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

#!/usr/bin/tclsh8.5
#
# Usage: git-unmerged branch1 branch2
#
# Shows all the non-common commits in the two branches, where non-common
# commits means simply commits with a unique commit *message*.
proc getlog branch {
lrange [split [exec git log $branch --oneline] "\n"] 0 400
}
@aoxu
aoxu / apnp_add.txt
Last active December 11, 2015 08:09
此文件用于添加东哥@cosbeta APNP中的域名白名单,可以直接复制粘贴。原理是比较东哥的白名单与地下铁路的白名单,将地下铁路多出来的部分提取出来。
265.com,2mdn.net,adnxs.com,adroll.com,adsonar.com,adtechus.com,aipai.com,atdmt.com,betrad.com,bluekai.com,cctv*.com,china.com,compete.com,douban.fm,etao.com,fantong.com,fastcdn.com,gamesville.com,google-analytics.com,harrenmedianetwork.com,homeinns.com,img.cctvpic.com,invitemedia.com,ipinyou.com,irs01.com,irs01.net,jing.fm,jysq.net,ku6cdn.com,kuaidi100.com ,legolas-media.com,live.com,lxdns.com,lycos.com ,lygo.com ,mangocity.com,mathtag.com,mediaplex.com,mediav.com,mlt01.com,mookie1.com,mosso.com,pixlr.com ,ptlogin2.qq.com,pubmatic.com,qstatic.com,quantserve.com,scanscout.com,scorecardresearch.com ,serving-sys.com ,sina.com,sinahk.net,sinajs.com ,snyu.com,staticsdo.com,sttlbb.com,tremormedia.com,tudouui.com,vizu.com,wrating.com ,xiu.com,yieldmanager.com,youshang.com,
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 17, 2024 02:53
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@dlutcat
dlutcat / linux_tips.sh
Last active December 12, 2015 07:48
LinuxTips历史发布归档
######
# 本归档每周末收录当周的Tips
######
# 以root身份执行上一条命令
$ sudo!!
# 返回用户主目录
$ cd
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import struct
from mutagen.easyid3 import EasyID3
def decode_gbk_from_unicode(s):
l, f = [], []