Skip to content

Instantly share code, notes, and snippets.

View clippit's full-sized avatar

Letian Zhang clippit

View GitHub Profile
@clippit
clippit / 小月月全集.txt
Created October 7, 2010 11:45
脱水全集《感谢这样一个极品的朋友给我带来了这样一个悲情的国庆,深度八做留恋。》
标题:[八卦江湖]感谢这样一个极品的朋友给我带来了这样一个悲情的国庆,深度八做留
恋。
作者:蓉荣 板块:娱乐八卦
首发:2010-10-05 11:45:00
××××××××××××××××××××××××××××××××××××××
日期:2010-10-05 11:45:00
首先,祝大家国庆节快乐!虽然我国庆节过的非常悲剧。
@clippit
clippit / gist:772429
Created January 10, 2011 05:50
modprobe ipv6 error
[root@vps ~]#modprobe ipv6
WARNING: Error inserting xfrm_nalgo (/lib/modules/2.6.18-194.32.1.el5xen/kernel/net/xfrm/xfrm_nalgo.ko): Unknown symbol in module, or unknown parameter (see dmesg)
FATAL: Error inserting ipv6 (/lib/modules/2.6.18-194.32.1.el5xen/kernel/net/ipv6/ipv6.ko): Unknown symbol in module, or unknown parameter (see dmesg)
============================================
[root@vps ~]#dmesg
Bootdata ok (command line is root=/dev/sda1 ro )
Linux version 2.6.18-194.32.1.el5xen (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Wed Jan 5 18:44:24 EST 2011
#in handlers.py:
class ImHandler(BaseHandler):
allowed_methods = ('GET',)
model = Message
fields = ('id',
('from_user', ('id', 'username', 'name'),),
'content',
'post_time',
)
@clippit
clippit / JPGEncoder.as
Created November 15, 2011 08:33
jpeg encoder
/*
Copyright (c) 2008, Adobe Systems Incorporated
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
@clippit
clippit / render_partial.rb
Created March 7, 2012 13:36
jekyll plugin that render an external page completely and include it
module Jekyll
class RenderPartialTag < Liquid::Tag
def initialize(tag_name, file, tokens)
super
@file = file.strip
end
def render(context)
site = context.registers[:site]
@clippit
clippit / gist:2118324
Created March 19, 2012 16:32
Play a 24 Game with four 0s
#include <stdio.h>
int main() {
printf("%d\n", '0'/(('0'+'0')/'0'));
printf("%d\n", '0'>>'0'/'0'+0);
printf("%d\n", -~-~-~-~-~-~0-~-~-~-~-~-~0-~-~-~-~-~-~0-~-~-~-~-~-~0);
return 0;
}
@clippit
clippit / pygments_code.rb
Created April 16, 2012 12:01
use {% codeblock lang:phpinline %} to highlight php codes that not starting with <?php in octopress
require 'pygments'
require 'fileutils'
require 'digest/md5'
PYGMENTS_CACHE_DIR = File.expand_path('../../.pygments-cache', __FILE__)
FileUtils.mkdir_p(PYGMENTS_CACHE_DIR)
module HighlightCode
def highlight(str, lang)
lang = 'ruby' if lang == 'ru'
@clippit
clippit / rubypython_archlinux_fix.rb
Created April 17, 2012 17:36
Fix Octopress Pygments Error on Arch Linux
require 'pygments'
if !!RUBY_PLATFORM['linux']
RubyPython.configure :python_exe => '/usr/bin/python2.7'
end
@clippit
clippit / octopress_twitter_aside_proxy.php
Created April 18, 2012 08:34
A tiny Twitter proxy for reading your timeline from Octopress aside. F**k G-F-W
<?php
if (strpos($_SERVER['HTTP_REFERER'], "dayanjia.com") === FALSE) {
header('HTTP/1.1 403 Forbidden');
die("Unauthorized access forbidden!");
}
header('Content-Type: application/json; charset=utf-8');
$user = $_GET['user'];
$count = $_GET['count'];
@clippit
clippit / schema.sql
Created May 27, 2012 08:34
database assignment 1
CREATE TABLE `test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`col1` enum('Mike','Bob','Jack','Alice','Cathy','Ann','Betty','Cindy','Mary','Jane') NOT NULL,
`col2` varchar(5) NOT NULL,
`col3` tinyint(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;