Skip to content

Instantly share code, notes, and snippets.

View vjache's full-sized avatar

Vyacheslav Vorobyov vjache

View GitHub Profile
@vjache
vjache / bt.ex
Created November 28, 2023 17:37
Behaviour Tree macro
defmodule EcssManagementSystem.Driver.Bt do
@moduledoc """
Example:`
defmodule BtScript do
use Bt
def run do
a = 1
all do
any do
This file has been truncated, but you can view the full file.
https://www.coop.ch/de/navigation/meganav/get?categoryCode=m_0475&_=1629798238733
https://www.amazon.com/dp/B0009R5B3U?th=1
https://play.google.com/_/PlayStoreUi/data/batchexecute?rpcids=qnKhOb&bl=boq_playuiserver_20191117.08_p1&gl=my&hl=ms&authuser&soc-app=121&soc-platform=1&soc-device=1&rt=c
https://www.coop.ch/de/lebensmittel/vorraete/pastasaucen-warme-saucen/saucen-gemischt/c/m_0166
https://www.amazon.com.au/gp/aod/ajax/ref=aod_f_freeShipping?asin=B08CXNTJ89&pageno=1&pc=dp
https://losangeles.craigslist.org/lac/ofc/d/san-diego-market-research-project/7369959933.html
https://www.bestbuy.ca/api/offers/v1/products/10434538/offers
https://www.zillow.com/homes/5266-S-Umatilla-Ave-Boise-ID-83709_rb
https://www.yelp.com/not_recommended_reviews/dannys-rv-repair-williams?not_recommended_start=40
https://www.nytimes.com/1910/05/06/archives/foot-caught-train-hit-her-girls-shoe-fast-in-track-frog-as-an.html
import subprocess
import sys
from queue import Queue
from subprocess import Popen
from threading import Thread
curls = Queue(10)
def do_curl():
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'
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
@vjache
vjache / sim.py
Last active February 14, 2020 16:01
Pool inflation simulation.
from random import randint
from time import sleep
target = .1
def proxy_id_gen():
c = 1
while True:
import time
from typing import Optional, cast, List
import brickpi3
from brickpi3 import BrickPi3
RGB = (int, int, int)
Percent = int
@vjache
vjache / util.erl
Created November 28, 2017 14:59
Flatten algorithm on Erlang.
%%
%% 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([]) ->
@vjache
vjache / PipeForward.kt
Created November 18, 2016 15:11
Pipe forward operator
operator fun <T,T1> ((T) -> T1).unaryPlus(): (T.()->T1) {
val f = this
return {
f(this)
}
}
fun mkStr(t:Int) : String {
return ""
}
@vjache
vjache / codec.erl
Created November 24, 2015 21:27
Encode/Decode problem on Erlang.
-module(codec).
-export([encode/1, decode/1]).
encode(Ss) ->
encode(Ss, "").
encode([], Enc) ->
lists:reverse(Enc);