Skip to content

Instantly share code, notes, and snippets.

View liorsbg's full-sized avatar
🐉

Lior Sabag liorsbg

🐉
View GitHub Profile

Keybase proof

I hereby claim:

  • I am liorsbg on github.
  • I am liorsbg (https://keybase.io/liorsbg) on keybase.
  • I have a public key ASAGUEDhGUMnyFH_rl8HEbx9slDGdr5uFjPIl_3SWD0s6Ao

To claim this, I am signing this object:

//WIP
init();
detect();
function init(){
//ROI
const [x1, x2, y1, y2] = [440,640, 80, 280];
let img = document.querySelector("img");
const API_URL = `http://13.82.136.127:8082/hls?x1=${x1}&y1=${y1}&x2=${x2}&y2=${y2}&imageUrl=${img.src}`;
let container = document.createElement("DIV");
@liorsbg
liorsbg / autopart.sh
Last active April 19, 2017 14:51 — forked from trentmswanson/autopart.sh
Linux bash script to partition and format all data disks in azure
#!/bin/bash
# An set of disks to ignore from partitioning and formatting
BLACKLIST="/dev/sda|/dev/sdb"
# Base directory to hold the data* files
DATA_BASE=""
usage() {
echo "Usage: $(basename $0) <new disk>"
}
#! /bin/bash
# echo "Hello"
# echo "I am $(whoami)"
# pip uninstall -y streamparse
# sleep 1
# pip install --user --ignore-installed streamparse
# echo "Done!"
export PATH=$PATH:/home/storm/.local/bin
#!/bin/bash
curl -sSO https://bootstrap.pypa.io/get-pip.py
python get-pip.py
@liorsbg
liorsbg / install_cloud_logging_agent.sh
Last active July 26, 2016 10:10
Install the Google Cloud Logging agent
#!/bin/bash
curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh
SHA=$(sha256sum install-logging-agent.sh)
EXP="07ca6e522885b9696013aaddde48bf2675429e57081c70080a9a1364a411b395 install-logging-agent.sh"
if [ "$SHA"="$EXP" ]; then
sudo bash install-logging-agent.sh
fi
sudo rm install-logging-agent.sh
import numpy as np
# Somehow this is half as fast
def np_batch_generator(iterable, batch_size=100):
# Initialize empty array of numpy arrays
batch = np.empty((batch_size), np.ndarray)
for index, item in enumerate(iterable):
batch[index % batch_size] = item
if index % batch_size == batch_size - 1:
yield batch
@liorsbg
liorsbg / poll.js
Last active April 25, 2016 13:10
Try a promise every `interval` ms until success or `max_intervals`
function delay(ms) {
console.log("Will wait...");
return new Promise(function(resolve, reject) {
setTimeout(resolve, ms);
});
}
function poll(func, interval, max_intervals) {
let retry = (func, tryNum, _resolve) =>
@liorsbg
liorsbg / evalUrl.js
Last active April 21, 2016 17:59
For when you want to test some JS from a url in your console.
function evalUrl(url){
fetch(url).then((res)=>res.text()).then((text)=>eval(text))
}