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
function createLock() { | |
const clients = new Map() | |
function nop() { | |
} | |
const lock = (id) => { | |
const waiting = clients.get(id) | |
if (!waiting) { | |
const queue = [] |
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 feather_dilate(stack: np.ndarray, radius=20): | |
"""Feather dilate a stack of images | |
stack has dimensions: [image_id, x, y] | |
The result is similar to dilation but with feather edges""" | |
ms = max_steepness | |
msq = ms * 2**0.5 | |
for x in range(1, stack.shape[2]): | |
stack[:,:, x] = (np.maximum(stack[:,:, x], stack[:,:, x-1] - ms)) | |
for x in range(stack.shape[2]-2, -1, -1): |
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 time | |
from sys import argv | |
run_args = "docker stats --format {{.MemUsage}}".split() | |
if len(argv) > 1: | |
run_args.append(argv[1]) | |
background = subprocess.Popen(run_args, stdout=subprocess.PIPE) | |
units = {'Ki': 1e3, 'Mi': 1e6, 'Gi': 1e9, 'Ti': 1e12} | |
print("timestamp_seconds", "memory_bytes", flush=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
#!/usr/bin/python3 | |
from PyQt5.QtWidgets import QApplication, QLabel, QMessageBox | |
from pyzbar import pyzbar | |
import numpy as np | |
def qimage2mat(qimage): | |
qimage.convertToFormat(4) | |
ptr = qimage.bits() | |
ptr.setsize(qimage.byteCount()) | |
arr = np.array(ptr).reshape([qimage.height(), qimage.width(), 4]) |
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 sys import argv | |
import cv2 | |
import numpy as np | |
import scipy | |
iterations = 2 | |
def grid(shape): | |
y = np.linspace(0, 1, shape[0]) | |
x = np.linspace(0, 1, shape[1]) |
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
#include <sstream> | |
#include <fstream> | |
#include <iostream> | |
#include <array> | |
class Buffer : public std::streambuf { | |
// we use ifstream here only for the sake of example | |
std::ifstream file; | |
std::array<char, 1024> data; | |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset=utf-8> | |
<title>Classifier</title> | |
<script> | |
let descriptors = []; | |
qs = (sel) => document.querySelector(sel); |
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 cv2 | |
import numpy as np | |
from tkinter import Tk | |
from tkinter.filedialog import askopenfilename | |
descriptors = [] | |
# evaluate the similarity between two point clouds | |
# enormous robustness against outliers is necessary | |
def score(a, b): |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="list.js"></script> | |
<script> | |
// generate list.js from images in current directory: | |
// (echo 'imageList = ['; ls *.{jpg,jpeg,JPG,JPEG} | sed -E 's/(.*)/"\1",/p'; echo ']') > list.js | |
// generate list.js from images in subdirectories of the current one: | |
// (echo 'imageList = ['; ( for d in *; do ls "$d"/*.{jpg,jpeg,JPG,JPEG}; done) | sed -E 's/(.*)/"\1",/p'; echo ']') > list.js |
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
<html> | |
<meta charset=utf-8> | |
<title>Timer</title> | |
<style> | |
@keyframes blinker { | |
50% { | |
opacity: 0; | |
} | |
} | |
body { |
NewerOlder