Skip to content

Instantly share code, notes, and snippets.

@sxgnccks
sxgnccks / db53.c
Created May 4, 2020 13:20
Linux下Berkeley DB命令行修改数据
#include <db.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define PATH_SEPARATOR "/"
char * __db_rpath(const char *path)
{
@sxgnccks
sxgnccks / spoofCensor.py
Created May 25, 2016 04:00
修改文件头。
'''
异或指定路径下文件的头部1M字节的内容
'''
import os
import sys
def do_xor(f):
with open(f,'r+b') as fp:
@sxgnccks
sxgnccks / 0_reuse_code.js
Created February 19, 2016 09:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@sxgnccks
sxgnccks / changeMD5.py
Last active September 27, 2015 09:06
python:change_file_MD5
import os
import subprocess
def do_rename(dir_name, f):
new_name = f
p = os.path.splitext(f.replace('-', ''))
if p[1] is not None:
new_name = 'R{0}{1}{2}.TPP.ttd'.format(
p[1][1].upper(), p[1][-1].upper(), p[0])
@sxgnccks
sxgnccks / RawRead.c
Created September 25, 2015 04:37
c/c++:使用直接硬盘访问读取文件
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <winioctl.h>
ULONGLONG *GetFileClusters(
PCHAR lpFileName,
ULONG ClusterSize,
ULONG *ClCount,
ULONG *FileSize
@sxgnccks
sxgnccks / immuno_lpk.py
Last active September 25, 2015 03:16
PYTHON:LPK
import os
# import platform
import win32file
import win32con
def undo_hiden_file(file_path):
# if 'Windows' in platform.system():
file_attr = win32file.GetFileAttributes(file_path)
if file_attr & win32con.FILE_ATTRIBUTE_HIDDEN:
@sxgnccks
sxgnccks / h.py
Created February 22, 2015 05:37
Python:找出目录下特定扩展名的文件
import os
import time
def main():
DEST_PATH='Z:\Downloads'
RET_PATH='D:\Downloads'
vedio_files=[]
for parent,dirnames,filenames in os.walk(DEST_PATH):
for f in filenames:
if '.' in f and f.rsplit('.',1)[1] in ['avi','mkv','mp4','rmvb','asf','wmv']: