Skip to content

Instantly share code, notes, and snippets.

View iwinux's full-sized avatar
👽

Limbo Peng iwinux

👽
View GitHub Profile
@iwinux
iwinux / gist:ef756e22e288595eed6d
Last active August 29, 2015 14:12
mtr --report douban.com
$ mtr -u --report douban.com
HOST: zerus Loss% Snt Last Avg Best Wrst StDev
1.|-- 115.182.xx.x 0.0% 10 0.3 0.3 0.3 0.3 0.0
2.|-- 60.195.255.109 0.0% 10 0.6 0.6 0.6 0.8 0.1
3.|-- 219.239.92.10 30.0% 10 49.4 37.8 2.2 63.4 22.2
4.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
5.|-- 10.244.1.25 90.0% 10 16.7 16.7 16.7 16.7 0.0
6.|-- ms-a-02-vlan10.dxt-idc.ne 70.0% 10 11.1 6.9 1.9 11.1 4.7
7.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
@iwinux
iwinux / mjolnir.lua
Last active August 29, 2015 14:13
window centering
local window = require "mjolnir.window"
local hotkey = require "mjolnir.hotkey"
local desiredWidth = 1024
local desiredHeight = 768
hotkey.bind({"cmd", "shift"}, "m", function()
local win = window.focusedwindow()
local screenBounds = win:screen():frame()
local destX = (screenBounds.w - desiredWidth) / 2 + screenBounds.x
@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
class Test
class << self
def x
return "X"
end
end
def y
return "Y"
end
#
# /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"
@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"
@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 / 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 / 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 / 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)