Skip to content

Instantly share code, notes, and snippets.

View press.one
{"sig":"ab153aa225008b691c26ede66a59cdf5bd56468840ff38975c3ef744bbf93191d57cc3826e44054f30c6b974c38cbdeda9084d46837466d936d7c3df2cd8508c1","msghash":"a3e720b292a02653b04cddc188f20a886379e221ca517ed3d7a46352df72590f"}
@roowe
roowe / sh
Last active Nov 9, 2017
speed_test
View sh
#!/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 Jan 8, 2017
头文件循环include
View a.hrl
-ifndef(DEFINE_a_HRL).
-define(DEFINE_a_HRL, true).
-include("b.hrl").
-define(a, a).
-endif.
@roowe
roowe / constant.erl
Created Mar 8, 2016
Erlang共享变量一种访问方式
View constant.erl
-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) ->
View gpb_benchmarks_Makefile
ifdef ERL
erl=$(ERL)
else
erl=erl
endif
ifdef ERLC
erlc=$(ERLC)
else
erlc=erlc
@roowe
roowe / lib_verifying_store_receipts.erl
Created Jul 2, 2015
In-App Purchase Programming之Verifying Store Receipts
View lib_verifying_store_receipts.erl
-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").
View gist:d011a51f55079d6293da
//++ 合并两个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();
View lists_rand.erl
%% 本数据结构大概目的,维护大规模数据选取小范围来随机,并定长维护,剔除老数据
-module(lists_rand).
-export([new/0, cur/1, in/2]).
-define(SIZE, 10000).
-define(CHOOSE_COUNT, 5).
-record(list_rand,{
max_size = ?SIZE,
View gist:9251518
<?php
print_r($_POST);
View gist:9251510
<!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 />