Skip to content

Instantly share code, notes, and snippets.

@harmy
harmy / classmates.md
Last active August 29, 2015 14:01
classmates.md

长泰一中2000届高三1班通信录

姓名 电话 常住地 行业/单位
林丁锋 18759129591 长沙 通信
杨金坤 18059632999 长泰 建材水电
郑宝林 13600975176 龙岩 制冷设备
杨鹏林 13400631318 厦门 IT
张景辉
@harmy
harmy / gist:eafa0f54988611167203
Created November 10, 2014 14:37
install jdk7 in ubuntu
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
To automatically set up the Java 7 environment variables JAVA_HOME and PATH:
sudo apt-get install oracle-java7-set-default
@harmy
harmy / exportCERT.sh
Last active August 29, 2015 14:10
exportCERT
#!/bin/sh
PROJECT_ROOT="$(pwd)/pvzsequel/proj.ios"
WORKSPACE="$PROJECT_ROOT/pvzsequel.xcodeproj/project.xcworkspace"
CONFIG="Release"
SCHEME="pvzsequel"
SDK="iphoneos"
TARGET="pvzsequel"
BUILDDIR="$PROJECT_ROOT/build"
OUTPUTDIR="$BUILDDIR/Release-$SDK"
@harmy
harmy / working_directory.py
Created June 9, 2015 17:24
A context manager which changes the working directory to the given path, and then changes it back to its previous value on exit.
@contextlib.contextmanager
def working_directory(path):
"""
A context manager which changes the working directory to the given
path, and then changes it back to its previous value on exit.
Original by Greg Warner:
http://code.activestate.com/recipes/576620-changedirectory-context-manager/#c3
"""
prev_cwd = os.getcwd()
os.chdir(path)
@harmy
harmy / generate_guild_sql.py
Created December 19, 2011 05:28
将行会数据从文本导入mysql
# -*- coding: gbk -*-
__author__ = 'harmy'
import glob
def main():
guild_master = {}
guild_member_count = {}
with open("update_guild.sql", "w+") as f:
#插入tbl_guild_member表
for txt_file in glob.glob("*.txt"):
@harmy
harmy / putin.py
Created December 19, 2011 06:01
在当前目录下建立所有tga文件的同名文件夹,并把tga文件移动到各自文件夹内
import os, shutil, glob
[os.mkdir(file[:-4]) for file in glob.glob("*.tga")]
[shutil.move(file, file[:-4]) for file in glob.glob("*.tga")]
@harmy
harmy / unzipgbk.py
Created December 30, 2011 10:42
Linux解压缩zip文件中文乱码问题的pathon解决方案
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import zipfile
print "Processing File " + sys.argv[1]
file=zipfile.ZipFile(sys.argv[1],"r");
@harmy
harmy / 2012.py
Created December 31, 2011 16:56
2012写的第一个程序
while datetime.today() <= "2012-12-21":
work_hard()
play_hard()
sleep()
if(life is not None):
print "hello world!"
@harmy
harmy / hequ.py
Created January 13, 2012 12:48
合区脚本
#encoding=gbk
import datetime
__author__ = 'harmy'
import os, sys, shutil, csv, shelve, multiprocessing
from multiprocessing import Process
if len(sys.argv) != 4:
print "用法: hequ.py 老区1数据路径 老区2数据路径 新区区id"
exit(1)
@harmy
harmy / CropMap.py
Created March 16, 2012 08:34
地图切图脚本
import os, shutil, glob
for file in glob.glob("*.jpg"):
print "processing %s..." % file
try:
shutil.rmtree(file[:-4])
except:
pass
os.mkdir(file[:-4])
os.system("convert.exe -crop 512x512 -quality 75%% -scene 1 %s %s\%%d.jpg" % (file, file[:-4]))