Skip to content

Instantly share code, notes, and snippets.

View vayn's full-sized avatar

Vayne Tsai vayn

View GitHub Profile
@ssokolow
ssokolow / README.markdown
Created August 13, 2010 06:09
Wordpress WXR to Jekyll exporter

Having decided to move my blog to Jekyll, I went looking for solutions. AzizLight's class proved the simplest, but fell short of what I wanted.

This version has been modified to be runnable as a command-line script (help available via -h) and, aside from category permalink continuity (which I'm working on), produces a ready-to-use _posts directory for your Jekyll blog.

Full details on the changes are available in the git commit log.

@Leechael
Leechael / WeiboController.php
Created January 25, 2011 05:23
The weibo oauth processing controller with li3_oauth.
<?php
namespace app\controllers;
use lithium\net\http\Router;
use lithium\storage\Session;
use li3_oauth\models\Consumer;
class WeiboController extends \lithium\action\Controller {
@vayn
vayn / factorial.py
Created July 16, 2011 16:34
Y combinator
#!/usr/bin/env python
# vim: set fileencoding=utf-8:
# @Author: Vayn a.k.a. VT <vayn@vayn.de>
# @Name: factorial.py
# @Date: 2011年07月16日 星期六 21时28分50秒
#
# 这是使用了赋值,以及需要 2 个参数的匿名函数的 factorial 实现。
# 赋值可以通过 () 符号取消掉,
# 使用 curry 这个技巧后可以减少一个参数,
# 这样就转化成 Y combinator 了
@tebeka
tebeka / sumtuples.py
Created November 1, 2011 17:58
Sum tuples of data using sqlite3
#!/usr/bin/env python
import sqlite3
def sumtuples(data, key_index):
cur = sqlite3.connect(':memory:').cursor()
cols = ['i{0}'.format(i) for i, _ in enumerate(data[0])]
schema = 'CREATE TABLE items ({0})'.format(','.join(cols))
cur.execute(schema)
@fractaledmind
fractaledmind / Export all Skim Notes to Evernote with Hyperlinks
Created September 7, 2013 23:15
This script will (as the title suggests) export all of you Skim notes directly to Evernote with hyperlinks. It relies on the GENERATE TOP 3 NOTES WITH SYSTEM URL script that will put 3 notes at the top of the PDF with linking information. When launched, the script will ask you if the current PDF is a Primary Source or a Secondary Source. Your ch…
@mahmoudimus
mahmoudimus / anaconda-mode.md
Created March 28, 2015 21:51
Emacs' anaconda-mode on MacOSX with Brewed Python

Background

You installed anaconda-mode and you've enabled it for use in Emacs. You also used homebrew to install your python distrubution. You open up a python file with anaconda-mode on.

Issue

You see a quick flash of Blocking call to accept-process-output with quit inhibited!! across your minibuffer. You switch to *messages* to see the errors and you see:

Blocking call to accept-process-output with quit inhibited!! [52 times]
@venj
venj / trans_gif.sh
Created November 1, 2016 03:59
convert video to gif
#!/bin/sh
# Convert video to gif.
if [[ $# -ne 3 ]]; then
echo "Usage: trans_gif source.mp4 target.gif 300"
exit 1
fi
palette="/tmp/palette.png"
filters="fps=15,scale=$3:-1:flags=lanczos"
@WeZZard
WeZZard / UIView+HitTestLiveTracing.h
Last active November 24, 2016 18:12
Lively trace UIView's hit testing
//
// UIView+LiveHitTestTracing.h
// UIViewLiveHitTestTracing
//
// Created by Manfred on 10/28/15.
//
//
@import UIKit;
@hzlzh
hzlzh / gist:eb87294712e78d4a96c4
Created June 24, 2014 06:36
Proxifier 走代理程序请求规则
"Alfred 2"; idea;Thunder*; iTerm; Terminal;php; Dropbox; Sparrow; "Sequel Pro"; python; ruby; wget; curl; GitHub; git-remote-https; npm; node; perl;prl*;itunes; sftp; whois;traceroute;stroke;ssh;ALiWangwang;MacUpdate*;git*;Git;fzs*;mail;flickr*;xulr*;imess*;com.apple.im*;Airmail;Adium;Prot*;Tokens;Ali*;Lite*;file*;ssh;ftp;Adobe*;PDApp*;Creative*;Vbox*;xulrunner;Virtual*;PDApp;Bit*;Domainers;fire*;plugin*;Atom*;Tokens;.com.realmacsoftware*;Xcode;java;httpd;
@EricTendian
EricTendian / favicon-colors
Created July 26, 2013 23:12
Nginx rewrite config for colored favicons, based on subdomain. If you have your dev. codebase, staging/qa. codebase, and your prod. codebase on the same server, you can give them different favicons to differentiate between the different branches. All subdomains that start with dev (such as dev.example.com and dev.app.example.com) would get the r…
location ~* /favicon(.*) {
log_not_found off;
access_log off;
root /var/www/default;
}
location = /favicon.ico {
if ($host ~* ^dev\.) {
rewrite ^/favicon\.ico$ /favicon-red.ico last;
}
if ($host ~* ^qa\.) {