Skip to content

Instantly share code, notes, and snippets.

@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 / 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;
}
@xkyii
xkyii / CMainFrame.h
Created July 8, 2011 05:23
控制窗口按钮
//使最小化按钮无效
void CMainFrame::OnDisableMinbox()
{
//获得窗口风格
LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE);
//设置新的风格
style &= ~(WS_MINIMIZEBOX);
::SetWindowLong(m_hWnd,GWL_STYLE,style);
@xkyii
xkyii / byteToHexStr.cpp
Created July 2, 2011 11:34
字符转化
#include <string>
std::string byteToHexStr(unsigned char byte_arr[], int arr_len)
{
std::string hexstr;
for (int i=0;i<arr_len;i++)
{
char hex1;
char hex2;
int value=byte_arr[i]; //直接将unsigned char赋值给整型的值,系统会自动强制转换
int v1=value/16;