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 <iostream> | |
template<unsigned long n> | |
struct Factorial { | |
enum {value = n * Factorial<n-1>::value}; | |
}; | |
template<> | |
struct Factorial<0> { | |
enum {value = 1}; |
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
import tornado.httpserver | |
import tornado.ioloop | |
import tornado.web | |
import tornado.gen | |
from tornado import httpclient | |
@tornado.gen.coroutine | |
def fetch_json(url): | |
response = yield httpclient.AsyncHTTPClient().fetch(url) |
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
#!/bin/bash | |
# By Hua Liang<et@everet.org> | |
host_name=$1 | |
if [ -z ${host_name} ] ; then | |
echo "hostname is empty" | |
exit | |
fi | |
echo ${host_name} |
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
import logging | |
import os | |
import datetime | |
sdk_name, game_code = "sdk", "code" | |
logger = logging.getLogger('[%s][%s]' %(sdk_name, game_code)) | |
logger.setLevel(logging.INFO) |
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
#!/bin/sh | |
# # m h dom mon dow user command | |
# 30 4 * * 1,3,4 root /root/backup_db.sh | |
# 41 4 * * 1,3,4 root /root/dropbox.py start | |
# 57 4 * * 1,3,4 root /root/dropbox.py stop | |
mysqldump -u root -p'password' --all-databases | gzip > /root/Dropbox/backups/mysql_bak/`date +%F`.sql.gz |
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
from subprocess import Popen, PIPE | |
output = Popen(["pmset", "-g", "assertions"], stdout=PIPE).communicate()[0] | |
def createItem(line, tag="title"): | |
return """<item arg="textEncoded"><%s>%s</%s></item>""" % (tag, line.strip(), tag) | |
def search(searchWord, tag="title"): |
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
; Made by Stupid ET <et@everet.org> | |
(progn | |
(replace-string "[opcode: 0]" "[opcode: 0 STOP_CODE]") | |
(beginning-of-buffer) | |
(replace-string "[opcode: 1]" "[opcode: 1 POP_TOP]") | |
(beginning-of-buffer) | |
(replace-string "[opcode: 2]" "[opcode: 2 ROT_TWO]") | |
(beginning-of-buffer) | |
(replace-string "[opcode: 3]" "[opcode: 3 ROT_THREE]") | |
(beginning-of-buffer) |
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
""" | |
opcode module - potentially shared between dis and other modules which | |
operate on bytecodes (e.g. peephole optimizers). | |
""" | |
__all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs", | |
"haslocal", "hascompare", "hasfree", "opname", "opmap", | |
"HAVE_ARGUMENT", "EXTENDED_ARG"] | |
cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is', |
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
# python increasing_file.py >> out.log | |
import os | |
import time | |
import sys | |
while True: | |
print "asdf" | |
sys.stdout.flush() | |
time.sleep(0.01) |
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
# 1,2,3,4,5,-1,0,1,2... | |
import signal | |
import sys | |
count = 0 | |
def signal_handler(signum, frame): | |
global count | |
count = -1 | |
print 'sig', count |
NewerOlder