Skip to content

Instantly share code, notes, and snippets.

View fourdollars's full-sized avatar
🏠
Working from home

Shih-Yuan Lee (FourDollars) fourdollars

🏠
Working from home
View GitHub Profile
/* Cascaded function calls in C */
#include <stdio.h>
#include <stdlib.h>
typedef struct Object Object;
struct Object {
Object* (*foo)(Object*);
};
@fourdollars
fourdollars / fourdollars.vim
Created December 17, 2009 14:19
fourdollars.vim
syntax on
set fileencodings=utf-8,big5,ucs-bom,iso8859-1
set termencoding=utf-8
set encoding=utf-8
set shiftwidth=4
set tabstop=4
set expandtab
set nocompatible
set hlsearch
$(function() {
var num = Math.round(Math.random(new Date()) * 46) % 46;
if (num < 26) {
num = num + 65;
} else {
num = num % 26;
num = num + 97;
}
alert(String.fromCharCode(num));
});
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# generate json data from txt file
import re
def main():
words = []
file = open("words.txt")
while True:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import curses
import time
import sys
def main(curses):
pad = curses.newpad(100, 100)
for y in range(0, 100):
" cursor highlight
set cursorline
highlight CursorLine cterm=NONE ctermbg=Black
autocmd InsertEnter * set nocursorline
autocmd InsertLeave * set cursorline
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 2.6.24-26-generic (buildd@vernadsky) (gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)) #1 SMP Tue Dec 1 18:37:31 UTC 2009 (Ubuntu 2.6.24-26.64-generic)
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: 0000000000000000 - 000000000009f400 (usable)
[ 0.000000] BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved)
[ 0.000000] BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
[ 0.000000] BIOS-e820: 0000000000100000 - 000000009fff0000 (usable)
[ 0.000000] BIOS-e820: 000000009fff0000 - 000000009fff3000 (ACPI NVS)
[ 0.000000] BIOS-e820: 000000009fff3000 - 00000000a0000000 (ACPI data)
#! /usr/bin/env sh
for master in $(nmblookup -M -- - | grep -v '^querying' | awk '{ print $1 }'); do
smbclient -U% -L $master 2>&1 1>/dev/null | grep '^Domain=' | head -n 1 | awk '{ split( $1, field, /[\[\]]/); print field[2] }'
done
#! /usr/bin/env bash
xrandr --newmode "1280x1024" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
xrandr --addmode VGA1 1280x1024
xrandr --output LVDS1 --off --output VGA1 --mode 1280x1024
#! /usr/bin/env bash
set -e -x
sizes="16 22 24 32 48 64 128 256"
for size in $sizes; do
[ ! -d icons/${size} ] && mkdir -p icons/${size}
convert -resize ${size}x${size} $1 icons/${size}/$2.png
done