Skip to content

Instantly share code, notes, and snippets.

{"sig":"ab153aa225008b691c26ede66a59cdf5bd56468840ff38975c3ef744bbf93191d57cc3826e44054f30c6b974c38cbdeda9084d46837466d936d7c3df2cd8508c1","msghash":"a3e720b292a02653b04cddc188f20a886379e221ca517ed3d7a46352df72590f"}
@roowe
roowe / sh
Last active November 9, 2017 13:53
speed_test
#!/usr/bin/env bash
speed_test(){
if [[ $1 == '' ]]; then
temp=$(python speedtest.py --share 2>&1)
is_down=$(echo "$temp" | grep 'Download')
if [[ ${is_down} ]]; then
local REDownload=$(echo "$temp" | awk -F ':' '/Download/{print $2}')
local reupload=$(echo "$temp" | awk -F ':' '/Upload/{print $2}')
local relatency=$(echo "$temp" | awk -F ':' '/Hosted/{print $2}')
@roowe
roowe / a.hrl
Created January 8, 2017 08:03
头文件循环include
-ifndef(DEFINE_a_HRL).
-define(DEFINE_a_HRL, true).
-include("b.hrl").
-define(a, a).
-endif.
@roowe
roowe / constant.erl
Created March 8, 2016 15:33
Erlang共享变量一种访问方式
-module(constant).
-export([compile/2]).
compile(Mod, KVList) ->
Bin = makes(Mod, KVList),
code:purge(Mod),
{module, Mod} = code:load_binary(Mod, atom_to_list(Mod) ++ ".erl", Bin),
ok.
makes(Module, KVList) ->
ifdef ERL
erl=$(ERL)
else
erl=erl
endif
ifdef ERLC
erlc=$(ERLC)
else
erlc=erlc
@roowe
roowe / lib_verifying_store_receipts.erl
Created July 2, 2015 02:47
In-App Purchase Programming之Verifying Store Receipts
-module(lib_verifying_store_receipts).
-include("common.hrl").
-include("define_http.hrl").
-include("define_info_10.hrl").
-export([send/1]).
-define(APP_VERIFY_RECEIPT_URL, "https://buy.itunes.apple.com/verifyReceipt").
-define(APP_SANDBOX_VERIFY_RECEIPT_URL, "https://sandbox.itunes.apple.com/verifyReceipt").
//++ 合并两个pb结构++//
public static void mergeFromPb(object oldObj, object newObj, List<string> ignore_list = null){
if(oldObj.Equals(newObj))
return;
Type oldType = oldObj.GetType();
Type newType = newObj.GetType();
// if(oldType.Equals(newType) == false){
// return;
// }
PropertyInfo[] newInfos = newType.GetProperties();
%% 本数据结构大概目的,维护大规模数据选取小范围来随机,并定长维护,剔除老数据
-module(lists_rand).
-export([new/0, cur/1, in/2]).
-define(SIZE, 10000).
-define(CHOOSE_COUNT, 5).
-record(list_rand,{
max_size = ?SIZE,
@roowe
roowe / gist:9251518
Created February 27, 2014 14:50
test.php
<?php
print_r($_POST);
@roowe
roowe / gist:9251510
Created February 27, 2014 14:49
data.html
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
</head>
<body>
<form name="input" action="/test.php" method="post">
I have a bike:
<input type="checkbox" name="vehicle1" value="Bike" />
<br />