Skip to content

Instantly share code, notes, and snippets.

View ADKosm's full-sized avatar
🏠
Working

Alex Kosmachev ADKosm

🏠
Working
  • Lisbon, Portugal
  • 19:21 (UTC +01:00)
View GitHub Profile
async function onPlay() {
// console.log("Play!")
const videoEl = $('#inputVideo').get(0)
let isLoaded = !!faceapi.nets.tinyFaceDetector.params
if(videoEl.paused || videoEl.ended || !isLoaded) {
console.log("Is not loaded yet!")
return setTimeout(() => onPlay())
<!DOCTYPE html>
<html lang="ru">
<head>
<title>PifPaf</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<script src="faceapi.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
combinations :: Int -> [(Int, Int)]
combinations n = do
a <- [1..6]
b <- [1..6]
if a + b == n then return (a,b) else []
solve :: [(Int, Int)]
solve = do
n <- [2..12]
return (n, length $ combinations n)
' ,
'
, ,
' ' ;:'dXX:
0MMMMMMMc
dNMWMMMMMNNl ,
WMWMMMMMMMWWc
oWMMMO:ckMMMO,
okkO: NMMM
Function<Integer, BinaryClassifier> learnClassicier = (Integer i) -> {
List<Boolean> booleanLabels = new ArrayList<>(labels.size());
for (int j = 0; j < labels.size(); j++) {
booleanLabels.add(labels.get(j) == i);
}
BinaryClassifier binaryClassifier = binaryClassifiers.get(i);
binaryClassifier.fit(train, booleanLabels);
return binaryClassifier;
}
MyThreadPool.map(learnClassicier, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
from multiprocessing import Pool
def f(x):
return x ** 2
data = [1, 2, 3, 4, 5]
with Pool(processes=4) as pool:
new_data = pool.map(f, data)
docker run -i -t -p 8888:8888 continuumio/anaconda /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir -p /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser --allow-root"
import re
import sys
patt1 = re.compile('^(.*)(\.|_|-)1.(fastq|fq|fastq.gz|fq.gz)$')
patt2 = re.compile('^(.*)(\.|_|-)2.(fastq|fq|fastq.gz|fq.gz)$')
prev_line = next(sys.stdin)
try:
for line in sys.stdin:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider "virtualbox" do |v|
v.memory = 8096
#!/usr/bin/ruby
require 'json'
require 'optparse'
options = {}
OptionParser.new do |opt|
opt.on('-s', '--size SIZE', "Set size of logs. By default 1500") { |o| options[:size] = o }
opt.on('-q', '--query QUERY', 'Set query to db. By default: { "match_all": {} }') { |o| options[:query] = o }
opt.on('-d', '--db DB', 'Set database to request. By default: universe-*') { |o| options[:db] = o}