Skip to content

Instantly share code, notes, and snippets.

View bugparty's full-sized avatar
🎯
Focusing

Bowen Han bugparty

🎯
Focusing
View GitHub Profile
@bugparty
bugparty / adhoc
Created September 13, 2013 00:50 — forked from anonymous/adhoc
#!/bin/bash
#####################################
#Author: Leon Lee #
#email: [email protected] #
#QQ: 730395591 #
#Version: 1.0 #
#Note: If you have some good ideas #
# or advice, please mail me^^ #
#####################################
package main
import (
"net/http"
"net/url"
"log"
"io/ioutil"
"regexp"
"fmt"
//"net/http/httputil"
@bugparty
bugparty / cowpower.py
Last active August 29, 2015 13:58
闲着蛋疼写的一个河北经贸大学自强之星刷人气工具,自动调整并发线程数,基本能保证服务器满负荷
#coding:utf8
__author__ = 'bowman'
import thread,time
import httplib
alive = 0
limit = 100
aliveLock = thread.allocate_lock()
finished = 0
succeed = 0
fLock = thread.allocate_lock()
@bugparty
bugparty / dshow_list_audio_device.cpp
Last active August 29, 2015 14:00
A working example of DirectShow Listing Video Input Devices
#include <stdio.h>
#include <dshow.h>
#pragma comment(lib, "strmiids")
int _tmain(int argc, _TCHAR* argv[])
{
ICreateDevEnum *pSysDevEnum = NULL;
HRESULT hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_SystemDeviceEnum,NULL, CLSCTX_INPROC_SERVER,
IID_ICreateDevEnum, (void **)&pSysDevEnum);
if(FAILED(hr)){
@bugparty
bugparty / newping.c
Created June 14, 2014 16:56
the original ping.c from Mike Muuss
/*
* P I N G . C
*
* Using the InterNet Control Message Protocol (ICMP) "ECHO" facility,
* measure round-trip-delays and packet loss across network paths.
*
* Author -
* Mike Muuss
* U. S. Army Ballistic Research Laboratory
* December, 1983
#!/usr/bin/env python3.2
# Benjamin James Wright <[email protected]>
# Maximum Subarray
def max_subarray(L):
current_sum = 0
current_index = -1
best_sum = 0
best_start_index = -1
best_end_index = -1
@bugparty
bugparty / gist:61af8f9fd94d2afb257f
Created January 21, 2015 09:16
从目录内搜集wmv文件并移动到根目录的脚本
import os
import shutil
cw = os.getcwd()
things =os.listdir(cw)
for thing in things:
filepath = os.path.join(cw,thing)
if os.path.isdir(filepath):
files = os.listdir(filepath)
for file in files:
if file.endswith('.wmv'):

##路径截断与合并##

PathRemoveArgs 去除路径的参数

PathRemoveBackslash 去除路径最后的反斜杠 ""

PathAddBackslash 在路径最后加上反斜杠 ""

PathRemoveBlanks 去除路径前后的空格

@bugparty
bugparty / observer.java
Created July 19, 2016 09:06
java观察者
/*
观察者接口
*/
interface Observer<T>{
/*
接受更新的状态
*param state 新的状态
*/
void update(T state);
}
@bugparty
bugparty / gist:fdf8c259d91cefacbd841584c602072a
Last active February 7, 2017 07:17
一份yuv转argb代码分析
JNIEXPORT void JNICALL Java_jp_co_cyberagent_android_gpuimage_GPUImageNativeLibrary_YUVtoARBG(JNIEnv * env, jobject obj, jbyteArray yuv420sp, jint width, jint height, jintArray rgbOut)
{
int sz;
int i;
int j;
int Y;
int Cr = 0;
int Cb = 0;
int pixPtr = 0;
int jDiv2 = 0;