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 / git-2.eclass
Created October 9, 2012 15:54
git wrap for portage
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.29 2012/04/03 10:32:09 pacho Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
# Michał Górny <mgorny@gentoo.org>
# Donnie Berkholz <dberkholz@gentoo.org>
# @BLURB: Eclass for fetching and unpacking git repositories.
# @DESCRIPTION:
@roowe
roowe / gist:2848998
Created June 1, 2012 05:08 — forked from zythum/gist:2848881
google收录的敏感词
@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,