Skip to content

Instantly share code, notes, and snippets.

View shiny's full-sized avatar
💭
I may be slow to respond.

Dai Jie shiny

💭
I may be slow to respond.
View GitHub Profile
var proxy = "SOCKS5 127.0.0.1:1081; SOCKS 127.0.0.1:1081; DIRECT;";
var direct = 'DIRECT;';
var domains = [
'twitter.com',
'google.com',
'google.com.hk',
't.co',
'twimg.com',
'github.com',
@shiny
shiny / upyun_form_upload.php
Last active August 29, 2015 14:10
upyun_form_upload
<?php
class upyun_form_upload {
private $policy = [];
private $secret_key;
function __construct($secret_key){
$this->secret_key = $secret_key;
}
function __call($function_name, $params){
$key = $this->underscore2hyphen($function_name);
if (!empty($params)) {
@shiny
shiny / example.php
Created March 26, 2015 11:48
example.php
<?php
function createStr($num = 700, $len = 6){
if($num===0){
return [];
}
$numbers = range(0, 9);
$letters = range('a', 'z');
$uppers = range('A', 'Z');
$elements = array_merge($numbers, $letters, $uppers);
$strings = [];
Benchmark Run: Sun Dec 30 2012 21:29:46 - 21:57:44
1 CPU in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 8184515.9 lps (10.0 s, 7 samples)
Double-Precision Whetstone 1833.6 MWIPS (9.8 s, 7 samples)
Execl Throughput 1137.1 lps (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 170016.0 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 47165.0 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 402211.7 KBps (30.0 s, 2 samples)
Pipe Throughput 284207.8 lps (10.0 s, 7 samples)
@shiny
shiny / Mpb
Created December 30, 2012 13:59
Benchmark Run: Sun Dec 30 2012 21:30:19 - 21:58:35
unknown CPUs in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 28050996.0 lps (10.0 s, 7 samples)
Double-Precision Whetstone 4032.4 MWIPS (9.8 s, 7 samples)
Execl Throughput 602.3 lps (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 600186.9 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 167574.2 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 1390130.7 KBps (30.0 s, 2 samples)
Pipe Throughput 984698.6 lps (10.0 s, 7 samples)
@shiny
shiny / aliyun
Created December 30, 2012 14:23
Benchmark Run: Sun Dec 30 2012 21:57:45 - 22:26:22
2 CPUs in system; running 2 parallel copies of tests
Dhrystone 2 using register variables 26176109.2 lps (10.0 s, 7 samples)
Double-Precision Whetstone 5340.4 MWIPS (9.9 s, 7 samples)
Execl Throughput 7423.6 lps (29.7 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 124316.5 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 32652.9 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 275769.1 KBps (30.0 s, 2 samples)
Pipe Throughput 2025220.5 lps (10.0 s, 7 samples)
@shiny
shiny / 360buy_price.py
Last active December 11, 2015 09:59
360Buy Price
import requests
import re
def fetch_jd_price(id):
s = requests.Session()
buy_url = 'http://gate.360buy.com/InitCart.aspx?pid='+str(id)+'&pcount=1&ptype=1'
status_url = 'http://cart.360buy.com/cart/miniCartServiceNew.action?'+\
'callback=jsonp&_=1358748376993&method=GetCart'
s.get(buy_url)
r = s.get(status_url)
@shiny
shiny / gist:5742782
Created June 9, 2013 08:19
launchctl load /Library/LaunchAgents/com.me.shadowsocks.plist 就会自动启动。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>OnDemand</key>
<false/>
<key>Label</key>
<string>com.me.shadowsocks.startup</string>
@shiny
shiny / smtp.coffee
Created September 15, 2013 06:42
send email via smtp
nodemailer = require "nodemailer"
transportOptions =
service: "QQ"
auth:
user: "example@qq.com"
pass: "password"
mailOptions =
from: "example@qq.com",
to: "xxx@qq.com",
@shiny
shiny / mailgun.coffee
Created September 15, 2013 04:58
send mail from mailgun. # how to use 1. npm install request 2. change: your mailgun api key; change your domain in request url
request = require 'request'
form =
from: 'shiguanglu <sys@shiguanglu.com>'
to: 'testuser <ice.shiny@gmail.com>'
subject: 'this is a test mail'
text: 'test mail body'
auth =
user: 'api'
password: 'YOUR API KEY FROM MAILGUN'