Skip to content

Instantly share code, notes, and snippets.

@xkyii
xkyii / astar.py
Created May 25, 2012 11:13 — forked from jdp/LICENSE
A* pathfinding over any arbitrary graph structure, with example Cartesian grid implementation
class AStar(object):
def __init__(self, graph):
self.graph = graph
def heuristic(self, node, start, end):
raise NotImplementedError
def search(self, start, end):
openset = set()
closedset = set()
@xkyii
xkyii / hook_func.lua
Created February 28, 2012 15:25
My Lua Script
-- func to be hooked
function test(a,b)
print('\norg test');
print('a='..a..' b='..b)
return a,b;
end
-- store original func
org_test = test;
@xkyii
xkyii / auto_google_search.py
Created February 22, 2012 06:49
My Python Script
# -*- coding: utf-8 -*-
import sys
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtWebKit import *
class Scrape(QApplication):
def __init__(self):
print('init')
super(Scrape, self).__init__(sys.argv)
@xkyii
xkyii / NotificationManager.js
Created February 6, 2012 07:34 — forked from quidmonkey/NotificationManager.js
NotificationManager for ImpactJS
/*
* Impact Plugin
* NotificationManager
* Written by Abraham Walters
* July 2011
* Jxyzzy Dev Company
* jxyzzy.com
*
* This plugin extends the Font class and allows you to pop-up a
* text Notification (spawnNote()), move it (this.pos) and have
@xkyii
xkyii / Button.js
Created January 17, 2012 03:39
A simple Button for Impact.js
// A Button Entity for Impact.js
// Has 4 States:
// * hidden - Not shown
// * idle - just sitting there
// * active - someone is pushing on it
// * deactive - shown, but not usable
// And 3 Events
// * pressedDown - activated when pressed Down
// * pressed - constantly fires when pressing
std::ifstream in("some.file");
std::istreambuf_iterator<char> beg(in), end;
std::string str(beg, end);
// or
std::ifstream in("some.file");
std::ostringstream tmp;
tmp << in.rdbuf();
std::string str = tmp.str();
@xkyii
xkyii / luabind_test.cpp
Created November 25, 2011 04:00
Luabind
#include <luabind/luabind.hpp>
#pragma comment(lib,"libluabindd.lib")
#pragma comment(lib,"lua51.lib")
#include <iostream>
using namespace std;
using namespace luabind;
class testlua
{
@xkyii
xkyii / minus_invite.py
Created October 12, 2011 03:02
pyUtil
# -*- coding: utf-8 -*-
import urllib2
import urllib
import cookielib
minus_invite = "http://min.us/rjRVW6n" #邀请地址
commit_url = "http://minus.com/api/login/register" #注册地址
def open_url():
"""打开邀请地址"""
@xkyii
xkyii / git乱码解决方案汇总.txt
Created July 13, 2011 05:41
git乱码解决方案汇总
原帖地址: http://topic.csdn.net/u/20110113/19/b0d5d506-4307-428b-a61d-7974aa66a2da.html
首先要说明的是:这里介绍的方法都是大部分是本人“悟”出来的,所以网上难有流传!
好方法不能自己私藏,否则就白忙乎这几天了,分享给有需要的朋友们。如果有转载,敬请注明来自*CSDN老邓*作品。
呵呵,给自己打广告,实在是无耻之极,权当无聊之时打字之用。
欢迎流传,为最优秀的分布式版本管理系统Git做宣传!!
步骤:
1. 下载:http://loaden.googlecode.com/files/gitconfig.7z
2. 解压到:<MsysGit安装目录>/cmd/,例如:D:\Program Files\Git\cmd
@xkyii
xkyii / GetModuleDirectory.h
Created July 11, 2011 05:26
GetModuleDirectory
CString GetModuleDirectory(void)
{
TCHAR tempstr[1024];
::GetModuleFileName(AfxGetInstanceHandle(),tempstr,sizeof(tempstr));
CString mulu;
mulu.Format(_T("%s"),tempstr);
mulu = mulu.Left(mulu.ReverseFind('\\')+1);
return mulu;
}