-
gcc -M hello.c
可以得到某文件依赖的头文件。 -
grep processor /proc/cpu_info
显示当前的CPU数目 -
sudo shutdown -r now
重启机器 -
sshfs yourname@host:/path/to/your/dir ~/local
sshfs挂载到本地 -
sudo -u fleuria bash
: 切换用户
This file contains hidden or 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
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
This file contains hidden or 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
int lookup(char *name, Nameval tab[], int ntab) | |
{ | |
int low, high, mid, cmp; | |
low = 0; | |
high = ntab - 1; | |
while (low <= high) { | |
mid = (low + high) >> 2; | |
cmp = strcmp(name, tab[mid].name); | |
if (cmp < 0) |
This file contains hidden or 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
find . -type f -not -regex '\./\.git.*' | xargs cat | wc -l |
This file contains hidden or 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
#Person | |
class Person | |
end | |
#class method | |
class Person | |
def self.address | |
puts "hangzhou" | |
end | |
end |
This file contains hidden or 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
#0> non-block call | |
Thread.new do | |
blahbla... | |
end | |
#1> 4 simple ways to call shell or cmd | |
`ps aux` |
This file contains hidden or 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
def block_new | |
puts Proc.new.call | |
end | |
block_new{"hello"} | |
#slow practice | |
def herp_pass_block(&block) | |
derp_call_block &block | |
end |
This file contains hidden or 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
ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) | |
if ROOT_PATH not in sys.path: | |
sys.path.append(ROOT_PATH) | |
sys.path.insert(0,ROOT_PATH); |
This file contains hidden or 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
python -m SimpleHTTPServer 8000 |
This file contains hidden or 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
// from http://www.nowamagic.net/librarys/veda/detail/802 | |
// 简单版 | |
function dump_obj(aObject) { | |
var s = ""; | |
for (var property in aObject) { | |
s = s + "\n " + property + ": " + aObject[property]; | |
} | |
alert(s); | |
} |
OlderNewer