Skip to content

Instantly share code, notes, and snippets.

@qianlifeng
qianlifeng / gist:8123612
Created December 25, 2013 14:23
Embedding python in C
extern "C" __declspec(dllexport) char* ExecPython(char* directory, char* file, char* query)
{
try{
PyObject *pName, *pModule, *pDict, *pFunc, *pValue, *pClass, *pInstance;
// Initialise the Python interpreter
Py_Initialize();
//// Create GIL/enable threads
@qianlifeng
qianlifeng / gist:ad605882358f1b3dfbae
Last active August 29, 2015 14:01
根据IP找到所有其解析的域名
## ALLTHEVHOSTS.py
## A quick little webscraper to identify all the webapps associated with an IP address.
#
# Version 1.0
#
## Usage allthevhosts.py <ip or URL> <outputfile (optional)>
import urllib2
import sys
import re
@qianlifeng
qianlifeng / gist:95023d6c8ce8b28518b8
Created June 29, 2014 14:06
Captcha recognition
{
"metadata": {
"name": "",
"signature": "sha256:bbab319b0472de839782b6df92a37a980cdfda7bbc5509b75aa268785be28fa8"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bayes
{
public class Bayes
@qianlifeng
qianlifeng / charfreq.csv
Created May 25, 2015 03:09
名字性别表
char male female
378860 63221
378757 51232
378096 29518
366515 51477
344928 174529
314939 114048
314608 29055
299132 39621
276918 87270
@qianlifeng
qianlifeng / ShareFoldeToEveryone
Last active August 29, 2015 14:24
共享文件夹给所有用户
#用例:某个目录是git目录,大家都需要向此目录提交commit
#新建用户组
groupadd git
#将用户加入用户组
sudo usermod -a -G git lqian
#将要共享的文件夹设置成此用户组
sudo chgrp -R git /var/www
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@qianlifeng
qianlifeng / .tmux.conf
Last active July 24, 2016 08:21
tmux配置
#-- base settings --#
set -g default-terminal "screen-256color"
set -g display-time 3000
set -g escape-time 0
set -g history-limit 65535
set -g base-index 1
set -g pane-base-index 1
# modify prefix to activate tmux
set-option -g prefix C-a
@qianlifeng
qianlifeng / shell.sh
Created July 31, 2015 11:33
SSH打隧道
ssh -C -f -N -R 3304:192.168.8.4:3306 test.fcgylapp.cn
@qianlifeng
qianlifeng / mitm.py
Created July 26, 2018 07:24
mitm.it 修改返回结果
from mitmproxy import flowfilter
from mitmproxy import ctx
class Intercept:
def response(self, flow):
if flow.request.url == "https://www.zbg.com/exchange/fund/controller/website/fundwebsitecontroller/getpayoutcoinrecord":
flow.response.text = r'xxxxxx'
addons = [