Skip to content

Instantly share code, notes, and snippets.

# nim c -r --threads:on --gc:orc
import cpuinfo, os, random, locks, deques
type
WorkReq = ref object
id: int
WorkRes = ref object
id: int
@tomlobato
tomlobato / throttle-and-debounce.sh
Created February 2, 2018 17:38 — forked from niieani/throttle-and-debounce.sh
throttle and debounce commands in bash
#!/usr/bin/env bash
declare -i last_called=0
declare -i throttle_by=2
@throttle() {
local -i now=$(date +%s)
if (($now - $last_called >= $throttle_by))
then
"$@"
import math, strutils
const
ArgsErrorMsg = "Incorrect number of arguments at pos $1 in function `$2`"
CharErrorMsg = "Unexpected char `$1` at pos $2"
proc eval(data: string): float =
## Evaluates math expression from string *data* and returns result as a float
var data = data.toLowerAscii()
@chrpinedo
chrpinedo / insert-signature-in-pdf.md
Created April 4, 2016 10:27
How to insert your signature in a PDF file by using PDFtk

How to insert your signature in a PDF file by using PDFtk

Your signature in all the sheets

  1. convert the signature image to PDF file
convert firma.png firma.pdf
@oderwat
oderwat / strAccessObj.nim
Last active March 16, 2020 15:06
Access Objects in Nim by strings for fields (wrapper automatisation)
import macros
type Foo = object
a: int
b: int
c: float
#[
dumpTree:
@vigosan
vigosan / install_nvim.sh
Last active February 27, 2018 21:51
Build and install neovim for Debian
#!/usr/bin/env bash
# Build and install neovim for Debian
pushd .
mkdir -p ~/src
cd ~/src
# Install cmake 2.8.10
cmake_package="cmake-3.3.1"
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@noteed
noteed / docker-ovs.md
Last active December 29, 2023 07:07
Docker - Open vSwitch setup
@crucialfelix
crucialfelix / gist:5072896
Created March 2, 2013 19:41
Instruments that split audio signals and return multi chanel arrays/
// these return more than one track
// they take a stereo in and return an array of stereo outs
Instr("splits.two",{ arg audio=0.0,lpf=200, lprq=0.5,hipass=100;
var lo,hi;
lo = RLPF.ar( audio, lpf,lprq);
hi = HPF.ar( audio, hipass);
@uriel1998
uriel1998 / volume.rb
Created February 10, 2012 17:55 — forked from jaspervdj/volume.rb
Set PulseAudio volume, mute, unmute, and change default sink (and automagically switch running audio streams) from the commandline
#!/usr/bin/ruby
#
# Moved to: https://github.com/uriel1998/volumerb
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
# Unported License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-sa/3.0/.
#
# Forked/derived from original by Jasper Van der Jeugt (jaspervdj);