Skip to content

Instantly share code, notes, and snippets.

@michael34435
michael34435 / trunkfile.py
Last active August 29, 2015 14:01
hex decoder/encoder by python
import sys,os,gzip
def is_gzip(filename):
f = open(filename, 'rb')
if f.read(2).encode('hex') == '1f8b':
return True
pass
return False
pass
@michael34435
michael34435 / test_file
Created May 24, 2014 06:02
hex encoder
3R‘)v‡)iƒ(„A)vw)e‰21P21P

##Google Market API(AKA Google Play API) for Android 原始檔案來自這裡
是一款以java做curl request模擬android上面存取Google Market的library

幾個要點如下

  • 每次最多的上限Request數量為__500__,換言之,每次的query組合只能撈出500筆的index
  • 有一定的頻率間隔存在
  • __最多__只能取出10筆資料
  • 帳號會一次被鎖24hr,如果期間不再繼續使用12hr就有解鎖可能
function reverse(&$s)
{
$len = strlen($s);
for ($count = 0; $count < $len; $count ++) {
$s = substr($s, 0, $count) . substr($s, -1) . substr($s, $count, $len - 1 - $count);
}
}
@michael34435
michael34435 / Permute.php
Created September 11, 2014 07:11
modify from stackoverflow(I forgot where is it :/)
<?php
class Permute implements Iterator
{
private $base;
private $count;
private $current;
public function __construct($base)
<?php
function download($path, $name, $range = null)
{
if (!file_exists($path)) {
header("HTTP/1.1 404 Not Found");
exit();
}
header("Pragma: public");
header("Expires: -1");
@michael34435
michael34435 / utf8_exec.php
Created October 20, 2014 09:55
improved utf8_exec with hstart
<?php
function utf8_exec($cmd, &$output = null, &$return = null, $shell = false, $prefix = "")
{
$cmd = "chcp 65001\r\n$cmd\r\n";
$tempfile = PATH_APP . "/cache/" . "php_exec$prefix.bat";
if (!$shell)
$cmd = preg_replace("/(\\\|\/){1,}/", "\\\\\\", $cmd);
file_put_contents($tempfile, $cmd);
$tempfile = realpath($tempfile);
@michael34435
michael34435 / compressed_tku_assist
Last active August 29, 2015 14:09
compressed by michael34435
1f8b 0808 62b2 6854 02ff 636f 6d70 7265
7373 6564 5f54 4b55 5f43 6c61 7373 5f41
7373 6973 7400 749d 4757 aa4d b7b5 ab4a
14e8 8108 424f 1405 7a02 82d8 1314 c51e
410c 3dd3 36f4 cca1 670e 3d73 f8b7 df35
ebf9 c638 e334 ced9 e33c efde 0af7 5db5
c25c 7355 ad5a 657a 76d4 3edb 3333 6372
c698 80dd 31ef 3660 fb6c da7c 99a0 f99f
ffab 98ff f57f 2e6b 27ec 89cb 1aeb 465c
ddfc efa7 f4f1 ff47 e6ca acf2 9b59 ffaf
@michael34435
michael34435 / services.php
Created April 4, 2015 03:22
camelize your action name in phalcon
<?php
use Phalcon\Text;
use Phalcon\Mvc\Router;
use Phalcon\Mvc\Dispatcher as MvcDispatcher;
use Phalcon\Events\Manager as EventsManager;
$di->set('dispatcher', function() {
$eventsManager = new EventsManager();
@michael34435
michael34435 / app.py
Last active August 29, 2015 14:23
download file from dmhy to your local system via put.io
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, requests, json, re, sys, codecs
from path import path
from pyquery import PyQuery as pq
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
__TOKEN__ = '{HERE_IS_YOUR_TOKEN}'