This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Shared Ring Buffer | |
-module(srb). | |
-export([new/2, push/2, pop/2, pop/1]). | |
-compile(export_all). | |
-record(counters, | |
{ clock :: non_neg_integer(), | |
max_size :: non_neg_integer() }). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
appendBatch(SomeDir, Events) -> | |
ProtoFile = filename:join(SomeDir, "flume.avpr"), | |
{ok, P} = eavro_rpc_fsm:start_link(Host, Port, ProtoFile), | |
AvroEvents = encode_events_to_eavro_api_events(Events), | |
{ok, Result} = eavro_rpc_fsm:call(Conn, appendBatch, _Args = [ AvroEvents ]). | |
encode_events_to_eavro_api_events(Events) -> | |
[ | |
[ [ {<<"timestamp">>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(codec). | |
-export([encode/1, decode/1]). | |
encode(Ss) -> | |
encode(Ss, ""). | |
encode([], Enc) -> | |
lists:reverse(Enc); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
operator fun <T,T1> ((T) -> T1).unaryPlus(): (T.()->T1) { | |
val f = this | |
return { | |
f(this) | |
} | |
} | |
fun mkStr(t:Int) : String { | |
return "" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% | |
%% Util module which contains a simple 'flatten list' | |
%% implementation which is not fastest but most comprehent. | |
%% | |
-module(util). | |
-export([flatten/1]). | |
%% Flatten empty list is an empty list. | |
flatten([]) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from typing import Optional, cast, List | |
import brickpi3 | |
from brickpi3 import BrickPi3 | |
RGB = (int, int, int) | |
Percent = int | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
from time import sleep | |
target = .1 | |
def proxy_id_gen(): | |
c = 1 | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def to_base(number, base): | |
res = [] | |
while True: | |
k = number % base | |
number = number // base | |
res.append(k) | |
if number == 0: | |
break | |
# res.reverse() | |
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl --http1.1 --no-keepalive --no-sessionid --insecure --ipv4 --tlsv1 --silent --show-error --path-as-is --proto '=http,https' --connect-timeout 20 --max-time 80 --request POST --data-raw 'do=query&queryMap.M_PARTNO=DXTN26070CY-13&queryMap.RESULT=Y' -H 'Content-Length: 59' -H 'Accept-Language: en-GB,en-US' -H 'Content-Type: application/x-www-form-urlencoded' -H 'X-Crawlera-Profile: desktop' -H 'X-Crawlera-Cookies: disable' -H 'Accept-Encoding: gzip,deflate' -H 'Host: www.wpgdadago.com' -U 50cb462fae5d4be4aab8df78c79008bb: -x localhost:8010 'https://www.wpgdadago.com/ProductList?do=query' | |
curl --http1.1 --no-keepalive --no-sessionid --insecure --ipv4 --tlsv1 --silent --show-error --path-as-is --proto '=http,https' --connect-timeout 20 --max-time 80 --request POST --data-raw 'do=query&queryMap.M_PARTNO=IRG4PSC71UDPBF&queryMap.RESULT=Y' -H 'Content-Length: 59' -H 'Accept-Language: en-GB,en-US' -H 'Content-Type: application/x-www-form-urlencoded' -H 'X-Crawlera-Profile: desktop' -H 'X-Crawlera-Cookies: disable' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import sys | |
from queue import Queue | |
from subprocess import Popen | |
from threading import Thread | |
curls = Queue(10) | |
def do_curl(): |
OlderNewer