Skip to content

Instantly share code, notes, and snippets.

View iwinux's full-sized avatar
👽

Limbo Peng iwinux

👽
View GitHub Profile
@iwinux
iwinux / reader.py
Created November 1, 2011 02:35
Print out GR items' title and url
#! /usr/bin/python
import sys
import json
from HTMLParser import HTMLParser
def main():
if (len(sys.argv) != 2):
print('No filename specified.')
sys.exit(1)
@iwinux
iwinux / isort.c
Created October 22, 2011 14:05
通用版的插入排序
/* 指针运算很费脑子 TAT */
void swap(char *s1, char *s2, size_t size) {
int i;
char tmp;
for (i = 0; i < size; i++, s1++, s2++) {
tmp = *s1;
*s1 = *s2;
*s2 = tmp;
@iwinux
iwinux / dictsort.c
Created October 21, 2011 18:34
字符串字典排序
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define M 6
#define N 5
/* reverse strcmp to get descending sort */
int cmp(char *s1, char *s2) {
return -strcmp(s1, s2);
@iwinux
iwinux / setup.sql
Created September 20, 2011 04:34
Set up a database in MySQL
CREATE DATABASE `databasename` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'mypass';
GRANT ALL ON databasename.* TO 'user'@'localhost';
@iwinux
iwinux / rc.lua
Created July 31, 2011 07:29
Awesome Configurations
require("awful") -- Standard awesome library
require("awful.autofocus")
require("awful.rules")
require("beautiful") -- Theme handling library
require("naughty") -- Notification library
beautiful.init("/home/winus/.cache/awesome/themes/zenburn/theme.lua")
terminal = "terminator"
#
# /etc/rc.conf - Main Configuration for Arch Linux
#
LOCALE="en_US.UTF-8"
DAEMON_LOCALE="no"
HARDWARECLOCK="localtime"
TIMEZONE="Asia/Shanghai"
KEYMAP="us"
CONSOLEFONT="ter-v20b"
class Test
class << self
def x
return "X"
end
end
def y
return "Y"
end
@iwinux
iwinux / gist:938151
Created April 23, 2011 01:59
CPU Temperature Widget for Awesome3
-- {{{ shell script: showtemp
-- #! /bin/bash
-- echo "scale=1; `cat /sys/devices/platform/coretemp.0/temp1_input`/1000" | bc
-- }}}
function get_cpu_temp()
local s = io.popen('showtemp')
local temp = s:read()
s:close()
return temp