Skip to content

Instantly share code, notes, and snippets.

@stephenjtong
stephenjtong / DC_encode.java
Last active December 13, 2015 20:29
字符串编码,解码使用dc -e密文P
//decode result with dc command like dc -e0000P
import java.math.BigInteger;
public class DC_encode {
public static void main(String[] args) {
String a="";
String b=args[0]+"\n";
for(int i=0;i<b.length();i++){
if(Integer.toBinaryString(b.charAt(i)).length()==8)
a=a+Integer.toBinaryString(b.charAt(i));
else{
@stephenjtong
stephenjtong / Sudoku.java
Last active December 13, 2015 20:29
暴力解数独 force brute to solve a Sudoku
//数独
import java.util.*;
public class Sudoku{
private static int steps=0;
private static int sudo[][]=new int[][]{
{0,0,0,0,0,9,6,0,0},
{0,0,7,0,0,1,0,0,0},
{0,4,0,0,0,0,0,0,0},
{0,0,0,0,4,0,0,0,0},
@stephenjtong
stephenjtong / google_play_validator.php
Last active December 11, 2015 12:38
PHP server side google play signature validation
<?php
$prefix = "-----BEGIN PUBLIC KEY-----\n";
$surfix = '-----END PUBLIC KEY-----';
$key = "your google play pub key";
$key =$prefix . chunk_split($key, 64, "\n") . $surfix;
$key = openssl_get_publickey($key);
if (false === $key) {
echo "invalid public key\n";
return;
@stephenjtong
stephenjtong / yunpan_sign.php
Last active May 15, 2016 00:59
云盘每日签到脚本
<?php
error_log("============\n".date('Y-m-d H:i')."\n", 3, 'logs/yunpan.log');
$cookie = '你的cookie,去掉token';
function get_token($cookie, $url = 'http://c4.yunpan.360.cn/user/login?st=449'){
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_COOKIE => $cookie,
CURLOPT_HTTPGET => true,
CURLOPT_HEADER => true,
@stephenjtong
stephenjtong / sim_weibo_post.php
Created January 8, 2013 09:45
模拟新浪微博网页发送和转发
<?php
//forward('3514498319000665', '转发');
function add($text){
$params = array(
'text'=>$text,
'rank'=>0,
'location'=>'home',
'module'=>'stissue',
@stephenjtong
stephenjtong / gist:4465811
Last active December 10, 2015 17:08
纯真数据库查询python代码。来源:互联网
#!/usr/bin/env python
# coding: utf-8
'''用Python脚本查询纯真IP库
增强traceroute
traceroute app.yinxiang.com | awk -F"[()]" '{if($2~/[0-9\.]./){printf("%s |",$0);system("python cip.py "$2);}else{print $0}}'

--
-- 表的结构 `area`
--
DROP TABLE IF EXISTS `area`;
CREATE TABLE IF NOT EXISTS `area` (
`id` int(11) NOT NULL auto_increment,
`areaID` int(11) NOT NULL,
`area` varchar(20) character set gbk NOT NULL,
/*
12306 Auto Login => A javascript snippet to help you auto login 12306.com.
Copyright (C) 2011 Kevintop
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes 12306.user.js