- 博客(38)
- 资源 (21)
- 收藏
- 关注
原创 luajit调用win32 api函数实现base64编码
local ffi = require("ffi")ffi.cdef[[int CryptBinaryToStringA( const char *pbBinary, int cbBinary, int dwFlags, char * pszString, int *pcchString);]]local crypt = ffi.load(ffi.os ==...
2018-10-29 10:39:56
571
原创 smartsniff用到的pcap接口函数
pcap_findalldevs_expcap_freealldevspcap_openpcap_closepcap_next_expcap_looppcap_compilepcap_setfilterpcap_freecodepcap_nextpcap_findalldevspcap_open_livepcap_open_offlinepcap
2015-01-11 21:19:41
729
原创 luajit调用api函数实现base64编解码
local ffi = require("ffi")ffi.cdef[[int __stdcall CryptBinaryToStringA( const char *pbBinary, int cbBinary, int dwFlags, char * pszString, int *pcchString);int __stdcall CryptStringTo
2012-10-05 13:14:19
2580
原创 pyQt 例程学习 -1-
试用了一段时间wxpython,想尝试一下pyQt,看看两者到底那个更好使些。网上赞pyQt的不少,应该也不是空穴来风,我看了几个pyQt的demo,的确很强大,虽然wxpython也不赖。更主要的原因是wxwidgets沿用MFC那套消息机制在python下看来有些繁琐,想试试Qt的signal-slot方式。一、MDI - pyQt demo1. 主窗口继承自QtGui.QMainWi
2012-08-05 15:14:21
2623
转载 wxPython中PropertyGrid控件的简单用法
pg.Append( wxpg.PropertyCategory("1 - Basic Properties") ) pg.Append( wxpg.StringProperty("String",value="Some Text") ) pg.Append( wxpg.IntProperty("Int",value=100) ) pg.Append
2012-04-09 10:26:38
5554
转载 使用CreateProcess要注意的
STARTUPINFO si; memset(&si, 0, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_SHOW; PROCESS_INFORMATION pi; int i = ::CreateProce
2012-03-19 14:54:17
518
原创 BCB 应用TRegistry读取Python目录
AnsiString KeyName, ver, s; KeyName = "\\SOFTWARE\\Python\\PythonCore"; TRegistry *Registry = new TRegistry(KEY_READ); TStringList *ps = new TStringList(); try { Registry->RootKey = HKEY
2012-03-19 13:51:11
972
转载 使用BCB6-TValueListEditor控件
TValueListEditor控件可实现类似属性选择窗口的功能。当然相比至下功能还是少了很多,不过很多情况下也够用了。通过重载类函数及控制控件消息响应的方式,打造一个自己满意的控件那不是当下我想做的事。在此记录该控件的简单使用方法1. 添加key->Value对ValueListEditor1->InsertRow("name", "value", true);参数:true ->
2012-03-10 14:28:57
1413
原创 Luajit 调用Advapi32.dll中API函数输出随机字串
local ffi = require("ffi")ffi.cdef[[int __stdcall CryptAcquireContextW( int *phProv, int pszContainer, int pszProvider, int dwProvType, int dwFlags);int __stdcall CryptGenRandom(
2012-03-07 22:12:59
801
转载 一段调用advapi32.dll中MD5函数的BCB代码
#ifndef TOOL_BOX#define TOOL_BOXextern "C"{/* Data structure for MD5 (Message-Digest) computation */typedef struct { unsigned long i[2]; /* number of _bits_ handled mod 2^64 */ unsigned l
2012-03-07 22:01:17
1038
转载 Web.py 入门例程
import web urls = ( '/(.*)', 'hello')app = web.application(urls, globals())class hello: def GET(self, name): if not name: name = 'World' retur
2012-03-07 21:41:59
502
转载 Twisted python 入门例程
from twisted.internet import protocol, reactorclass Echo(protocol.Protocol): def dataReceived(self, data): self.transport.write(data)class EchoFactory(protocol.Factory): def buildP
2012-03-07 21:40:07
735
转载 C++ 内嵌 python 例程
#include intmain(int argc, char *argv[]){ PyObject *pName, *pModule, *pDict, *pFunc; //所有针对python的输入输出对象 PyObject *pArgs, *pValue; int i; if (argc < 3) { fprintf(stderr,"U
2012-03-06 17:37:15
604
转载 Base64编解代码
AnsiString DecodeBase64(AnsiString Source) { byte x1,x2,x3,x4,xt; int SrcLen,Times,i; AnsiString Result; Result= " "; SrcLen=Source.Length(); Times=SrcLen /
2012-03-04 13:31:04
505
转载 BCB6 使用线程对象
不废话,贴代码1. 线程对象//---------------------------------------------------------------------------#ifndef Unit2H#define Unit2H//-----------------------------------------------------------------------
2012-03-04 13:13:50
940
原创 BCB6 控件对象枚举
for(int i = 0; i ControlCount; i++){ TControl *pctrl = GroupBox1->Controls[i]; int tag = pctrl->Tag; if(pctrl->ClassNameIs("TComboBox"))
2012-03-03 21:35:24
519
原创 Openmp在暴力猜测MD5源字串一例
//gcc -fopenmp -O2 -static -s omp_pwd_md5.c md5.c -o omp_pwd_md5.exe#include #include "md5.h"#include #define PASSWD_MAXLEN 32#define PASSWD_SET_SIZE 36const char *passwd_words = "0123456789abc
2012-03-03 21:27:04
653
原创 BCB6 listView使用的几个技巧
1. 写入数据 CppSQLite3DB db; db.open("test.db"); CppSQLite3Query q = db.execQuery("select * from db.tablename"); ListView1->Items->BeginUpdate(); while(! q.eof()){ TListItem
2012-03-03 15:07:41
4078
转载 OpenMP & Fortran
在Fortran中应用OpenMP,有时会遇到一行中openmp的编译指令太长,需要换行的情形。今天在网上看到一段例程,明白了该如何处理这种情形。!$omp parallel &!$omp shared ( h, n ) &!$omp private ( i, x ) 源自http://people.sc.fsu.edu/~jburkardt/f_src/openmp/comp
2012-03-01 08:41:19
2600
转载 一些Mingw工具的使用方法
0. DLL --> DEFpexports xxx.dll > xxx.def1. dlltool 生成导出库dlltool -d xxx.def -l xxx.adlltool --dllname xxx.dll --def xxx.def --output-lib xxx.dll.aFor VC: lib /machine:i386 /def:xxx.de
2012-02-27 11:28:21
1337
原创 近期看过的一些网页
1. TCC主页 :http://bellard.org/tcc/2. 某网友的: http://www.willus.com/3. LLVM:http://llvm.org/ (和编译器有关)4. LLVM-LUA:http://code.google.com/p/llvm-lua/5. IBM开发者上的一篇TCC介绍:http://www.ibm.com/developer
2012-02-27 11:26:24
754
原创 使用tcc编译器
TCC是纯C编译器,支持C99标准,有些独到特点。1. TCC的主页(已停止开发)2. 编译TCCgcc -O2 -shared -Wall -Wl,--export-all-symbols -mpreferred-stack-boundary=2 -march=i386 -falign-functions=0 -fno-strict-aliasing -DTCC_TARGET_P
2012-02-27 10:50:31
5703
转载 Stdcall and DLL tools of MSVC and MinGW
Stdcall and DLL tools of MSVC and MinGWThe __stdcall calling convention has been there for a very long time. When the older calling conventions like __pascal fell into oblivion, __stdcallbecame
2012-02-26 15:58:45
650
原创 垃圾代码一堆
#coding=GB18030import httplib, urllibfrom hashlib import sha1, md5from rsaEncrypt import gen_key, rsa_encrypt, gen_randomimport socketimport repatt1 = re.compile('sip:(\d+)@')patt2 = re.compil
2012-02-25 22:31:20
971
原创 一段用Python语言的Ctypes模块调用系统api函数写的rsa加密代码
from ctypes import *from binascii import a2b_hex, b2a_hex#baseCrypt = u"Microsoft Base Cryptographic Provider v1.0"CryptAcquireContextW = windll.Advapi32.CryptAcquireContextWCryptImportKey = win
2012-02-25 22:20:08
1295
转载 调用mpfr的一段示例(极不完整)
char buffer[2048]; mp_exp_t e; unsigned int i; mpfr_t s, t, u; mpfr_init2 (t, 200); mpfr_set_d (t, 1.0, GMP_RNDD); mpfr_init2 (s, 200); mpfr_set_d (s, 1.0, GMP_RNDD); mpfr_init2 (u,
2012-02-25 22:06:34
6884
转载 C++ 嵌入 Lua 脚本 示例代码
// lua.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include #include #include #include //lua头文件extern "C" //在c++中调用C库{#include #include #i
2012-02-25 14:35:21
1547
转载 CppSqlite Demo
////////////////////////////////////////////////////////////////////////////////// CppSQLite3 - A C++ wrapper around the SQLite3 embedded database library.//// Copyright (c) 2004..2007 Rob Groves.
2012-02-25 14:32:45
877
原创 一段为图像处理做准备的BCB代码
Graphics::TBitmap *pb = Image1->Picture->Bitmap; int img_H = pb->Height; int img_W= pb->Width; Graphics::TBitmap *pc = new Graphics::TBitmap; pc->PixelFormat = pf24bit; pc->Width
2012-02-25 14:23:43
783
原创 我关注过的一些软件
此贴用以记录那些我认为优秀的软件(排名不分先后)。1. sysinternals Suite http://technet.microsoft.com/en-us/sysinternals/bb842062评价:越做越强的系统软件,能力非凡。2. nirSoft http://www.nirsoft.net/评价:算sysinternals的补充吧?不过nirsoft的关注点不
2012-02-12 15:11:39
306
原创 luajit 2.0下可用的luars232模块
个人觉得Luajit做的相当棒,将本身已经很快的lua脚本运行速度再次提升。而且大部分Lua5.1的外延模块(包括二进制的)在Luajit下仍可使用,但例外的情况总是有的,luars232模块就是其一。查其原因,出在luars232.c里的这一条语句 p = (struct rs232_port_t*) luaL_checkudata(L, 1, MODULE_NAMESPACE);
2012-02-12 14:29:21
919
1
原创 在MSYS下用MingW GCC编译libgmp的一个小问题及解决方法
昨天在Msys下用MingW GCC 4.7.0编译libgmp时遇到一个问题,说找不到"m4 gcc"这个文件。其实一看就知道这是两个不同的文件,错误是由libtool报出的,因此很可能是libtool脚本写的有问题,或是Windows环境下脚本的解释有问题。最终查到问题涉及的直接文件是mpn/Makefile,修改其1023行(libgmp版本5.0.4)原行:$(LIBTOOL) -
2012-02-12 13:49:42
1208
原创 非官方的python模块下载地址
1. http://www.lfd.uci.edu/~gohlke/pythonlibs/ - 很不错的,通常版本比较新。
2011-11-16 17:54:15
898
转载 用 Mingw gcc 编译 dll
#include __declspec(dllexport) int __cdecl Add(int a, int b){ return (a + b);}BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved){ switch (fdwReason)
2011-11-11 10:05:37
798
原创 微调 spcomm3.0
spcomm3.0是个不错的for delphi&c++ builder的串口组件。大致看了看代码,觉得比较清爽。导入到BCB6.0也很方便,不过在使用这个组件的时候遇到了一点问题,不过很快都解决了。留下本文以作记录,备不时之需。问题1:打开串口失败。程序会抛出异常,说明打开串口失败。这很奇怪,因为立即可以用pyserial打开,读写均正常。于是调试+读spcomm源代码,发现问题
2011-11-01 16:37:31
841
原创 itco-wdt.c
itco-wdt.c首先是个很好的linux源代码阅读网站。在此看到了intel芯片组集成的看门狗设备的管理方法。517行 给出写设备的关键 - 发'V'到狗,提示它不要重启电脑。615行 注册给狗的回调函数。
2011-03-24 04:20:00
946
原创 在linux下用ffmpeg摄录摄像头视频
<br />ffmpeg -r 30 -s 640x480 -b 320000 -f video4linux2 -i /dev/video0 sample.mp4
2010-12-04 14:51:00
1495
原创 开源PDF2SVG的Bug
顾名思义, pdf2svg能将pdf文档转换成svg文档. 这个工具利用了cairo库, 和xpdf一样. pdf2svg的当前版本号是0.2.1, 估计bug还不少. 我在将一个用asymptote画的太极阴阳图转成svg的过程中发现一个bug(自己试一下吧).不过一般用用还是可以接受的.
2010-02-25 11:44:00
1915
wxWidgets dll compiled with gcc 4.7.1
2012-07-16
pdflib 8.0.4p2 no-demo-waterprint
2012-07-12
pdflib for python version 8.0.4p2
2012-07-12
libtcc 动态链接库和头文件
2012-03-04
libmpfr 3.1.0 dll & static-lib
2012-02-12
ejtag-tinyice driver & spiflash
2011-11-07
PXE方式安装WinXP
2011-03-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人