Skip to content

Instantly share code, notes, and snippets.

View avivklas's full-sized avatar

Aviv Klasquin Komissar avivklas

View GitHub Profile
package coalescing
import (
"context"
"sync/atomic"
)
func Q(ctx context.Context, bufferSize int, fn func()) func() {
var (
q = make(chan int64, bufferSize)
@avivklas
avivklas / select4.go
Last active July 24, 2021 10:19
selectn blog snippets
func select4(ctx context.Context, chanz []chan interface{}, res chan *r, r *r, i int) {
select {
case r.v, r.ok = <-chanz[0]:
r.i = i + 0
res <- r
case r.v, r.ok = <-chanz[1]:
r.i = i + 1
res <- r
case r.v, r.ok = <-chanz[2]:
r.i = i + 2
@avivklas
avivklas / gstreamer-build.sh
Created December 12, 2017 05:18 — forked from sphaero/gstreamer-build.sh
Install & build gstreamer from git
#!/bin/bash --debugger
set -e
BRANCH="master"
if grep -q BCM2708 /proc/cpuinfo; then
echo "RPI BUILD!"
RPI="1"
fi
[ -n "$1" ] && BRANCH=$1
@avivklas
avivklas / ecs_deploy.sh
Last active June 6, 2017 19:29
Builds docker image locally, pushes to AWS ECR, creates new ECS task definition according to provided json file and updates an ECS service with the new task definition
#!/usr/bin/env bash
set -e
set -u
function usage() {
set -e
cat <<EOM
##### ecs-deploy #####
@avivklas
avivklas / QueueDBWriter.java
Created January 25, 2017 18:59
Local message queue for database updates as a part of a Java application
import com.j256.ormlite.dao.Dao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.function.Function;
public class QueueDBWriter<T, E> {
'use strict';
/**
* @ngdoc function
* @name myApp.directive:datePicker
* @description
* # datePicker
* Directive of the myApp
*/
angular.module('myApp')