Skip to content

Instantly share code, notes, and snippets.

View borgle's full-sized avatar

波哥 borgle

View GitHub Profile
@borgle
borgle / MD5Utils.java
Created August 28, 2015 09:13
获取文件或者某个字符串的MD5 hash值
package com.gkeeps.tools;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@borgle
borgle / gist:ff641a1c71d5d018d031
Last active August 29, 2015 14:05
一个简单的按指定行数分割文件python代码,有时候分析系统记录的日志非常方便
#!/usr/bin/env python
#coding=utf-8
import time,re,os,sys
def module_path():
""" This will get us the program's directory,
even if we are frozen using py2exe"""
if hasattr(sys, "frozen"):
@borgle
borgle / Application.java
Last active August 29, 2015 14:26
RSA工具:可以生成密钥对,可以把c#格式、openssl格式的密钥对进行互转,可以进行字符串的加解密。
package com.gkeeps.tools;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.security.interfaces.RSAPrivateCrtKey;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
@borgle
borgle / jquery.stringify.js
Created August 21, 2015 05:37
收集并完善的一份jquery插件,将json对象转换为字符串功能,支持低版本浏览器。来源:https://gist.github.com/chicagoworks/754454
jQuery.extend({
stringify : function stringify(obj) {
if ("JSON" in window) {
return JSON.stringify(obj);
}
var t = typeof (obj);
if (t != "object" || obj === null) {
// simple data type
if (t == "string") obj = '"' + obj.replace(/"/g,'\\\"') + '"';
@borgle
borgle / PC Wifi Helper.bat
Created September 2, 2015 09:20
在window系统上辅助建立WiFi热点的批处理脚本
@echo off
Title PC Wifi Helper.
:start
echo Please choose method to Dial:
echo 1. Create WiFi hosted
echo 2. Start Wifi hosted
echo 3. Stop Wifi hosted
echo x. Exit
choice /c 123x /n /m Select: /t 10 /d x
@borgle
borgle / taoyer.code.crack.py
Created November 25, 2015 07:55
利用cloudsightapi破解电信积分手机版本图形验证码测试代码
#!/usr/bin/env python
#coding: utf-8
import requests
import json,time,os
REQURL = 'https://api.cloudsightapi.com/image_requests'
RESPURL = 'https://api.cloudsightapi.com/image_responses'
headers = {"Authorization":"CloudSight 39OOYyT553WHpEPlo2Ehcw00",
@borgle
borgle / gist:4689628
Created February 1, 2013 06:12
this is jquery-pager-plugins demo.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> jquery pager demo</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/yoker/jquery-pager-plugins/master/jquery.pager.min.js"></script>
<script type="text/javascript">
<!--
function go(p){
$("#info").html("<h1>this is "+ p + " page.</h1>");
@borgle
borgle / gist:5795121
Created June 17, 2013 07:11
根据html代码利用WebBrowser控件生成图片功能。 可以利用此代码完成长微博的发布。
namespace Utils
{
/*
Bitmap bitmap = Utils.Html2Image.GenerateImage("<h1>标题一</h1><h2>标题二</h2><font color=\"red\">红色普通</font><br /><img src=\"https://www.google.com/images/srpr/logo4w.png\" />", 440);
//MemoryStream ms = new MemoryStream();
//bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);//JPG、GIF、PNG等均可
bitmap.Save(Server.MapPath("img.png"), System.Drawing.Imaging.ImageFormat.Png);
*/
using System;
using System.Drawing;
@borgle
borgle / gist:5795401
Created June 17, 2013 08:20
利用BasicAuthorization方式直接调用接口发送微博,无需采用oauth方式需要不停的授权活动用access_token来做。
namespace Utils
{
/*
Dictionary<string, string> texts = new Dictionary<string, string>();
texts.Add("source", "app key");
texts.Add("status", "post weibo test " + DateTime.Now.ToString());
texts.Add("visible", "2");
Dictionary<string, string> files = new Dictionary<string, string>();
files.Add("G:\\Desktop\\wiki_logo.png", "image/png");
@borgle
borgle / MovePicture.py
Last active December 24, 2015 16:25
【更新根据exif读取时间】图片太多,写个脚本整理图片到子文件夹,按照图片的创建时间整理。
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os,time,shutil,sys
import exifread
folder = os.path.join(os.path.dirname(__file__), "a")
for fname in os.listdir(folder):
fpath = os.path.join(folder,fname)
sys.stdout.write(u"\r正在处理 %s" % fpath)