This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- {{{ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test | |
class << self | |
def x | |
return "X" | |
end | |
end | |
def y | |
return "Y" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# /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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 指针运算很费脑子 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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) |
OlderNewer