Skip to content

Instantly share code, notes, and snippets.

@harmy
harmy / makeMap.py
Last active December 21, 2015 10:48
地图相关工具脚本
#coding=gbk
import glob, tmxlib, os, base64
"""
生成空地图,添加所有物件和地表
"""
from tmxlib.fileio import *
class MySerializer(TMXSerializer):
def image_to_element(self, image, base_path):
if image.source is None:
element = etree.Element('image', attrib=dict(format='png'))
@harmy
harmy / createdb.sql
Last active December 21, 2015 14:18
drop database if exists game;
drop database if exists info;
create database game default charset utf8;
create database info default charset utf8;
create user 'game'@'localhost' identified by 'game';
create user 'game'@'%' identified by 'game';
grant all privileges on game.* to 'game'@'localhost';
grant all privileges on game.* to 'game'@'%';
@harmy
harmy / gist:6446857
Created September 5, 2013 07:04
用astyle批量整理代码
for /R %f in (*.cpp;*.c;*.h) do c:\tools\astyle -p -U --style=ansi "%f"
来自:http://blog.csdn.net/memory_xj/article/details/2983093
@harmy
harmy / HideVirtualBox.bat
Created October 31, 2013 06:02
run games like mapstory or 梦幻西游 in virtualbox.
@echo off
@reg copy HKLM\HARDWARE\ACPI\DSDT\VBOX__ HKLM\HARDWARE\ACPI\DSDT\NOBOX__ /s /f
@reg delete HKLM\HARDWARE\ACPI\DSDT\VBOX__ /f
@reg add HKLM\HARDWARE\DESCRIPTION\System /v SystemBiosVersion /t REG_MULTI_SZ /d "NOBOX - 1" /f
@exit
@harmy
harmy / oldbooks.md
Last active December 30, 2015 23:59
这些书准备出售

全部已出

@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 / justinguitar.py
Created September 26, 2015 15:33 — forked from nhanb/justinguitar.py
Grabbing all lesson videos from justinguitar's beginner course
#!/usr/bin/env python
import requests
import re
from bs4 import BeautifulSoup
from subprocess import call, check_output
import string
def fetch_html(links):