Skip to content

Instantly share code, notes, and snippets.

View borgle's full-sized avatar

波哥 borgle

View GitHub Profile
@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 / get-idcard.py
Last active October 11, 2017 07:51
在微博上看到无数次有人说火车票上身份证隐藏的四位用程序很容易跑出来,刚才验证了一下,确实很容易跑出来,不过你不知道具体是哪一个。因为有太多符合身份证规则的值了。以下是18位身份证验证的代码片段。
#!/usr/bin/python
# -*- coding: utf-8 -*-
dbstr = lambda x : x < 10 and '0' + str(x) or str(x)
ai = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
wi = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"]
cardid = "522636%(y)s%(m)s%(d)s8735"
for y in range(1970, 2000):
for m in range(1, 13):
for d in range(1, 31):
@borgle
borgle / gist:c846d07cdaa70933fd30
Created November 12, 2013 02:55
我的python html抓取代码。 data为一个dict值,是需要post的数据字典。
#!/usr/bin/python
# -*- coding: utf-8 -*-
import socket,urllib,time,urllib2
import re,StringIO,gzip
def gethtml(pageurl, data=None):
theheaders = {
'User-agent' : 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko)',
'Accept-Encoding' : 'gzip, deflate',
@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 / 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 / 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