Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am vyskocilm on github.
  • I am vyskocilm (https://keybase.io/vyskocilm) on keybase.
  • I have a public key ASCXoesMzFaReZpJHNkdpt2RvK6efXKCv-EQ-Ef-W_6_SQo

To claim this, I am signing this object:

@vyskocilm
vyskocilm / main.go
Created Dec 3, 2020
Arbitrary precision calculator for Go
View main.go
package main
import (
"fmt"
"github.com/cosmos72/gomacro/fast"
)
func RunGomacro(toeval string) float64 {
interp := fast.New()
vals, _ := interp.Eval(toeval)
@vyskocilm
vyskocilm / szproc.go
Created Oct 28, 2019
Stress zproc test
View szproc.go
package main
import (
"fmt"
"io/ioutil"
"log"
"os/exec"
)
// stress zproc for https://github.com/zeromq/czmq/issues/2007
@vyskocilm
vyskocilm / srv.go
Last active Dec 19, 2018
Testing cors.Cors and golang net/http
View srv.go
//
// simple net/http + cors.Cors integration
// vyskocilm.github.io/blog
//
package main
import (
"fmt"
"log"
"net/http"
@vyskocilm
vyskocilm / stackhttp.go
Created Dec 18, 2018
Stacked http.Handler in golang
View stackhttp.go
//
// Stacking net/http handlers
// vyskocilm.github.io/blog
//
package main
import (
"fmt"
"log"
View gazpacho1.md
.
├── g
│   ├── cfg
│   │   ├── cfg.go
│   │   ├── cfg_test.go
│   │   ├── go.mod
│   │   └── testdata
│   ├── go.mod
│   └── lib.go
View gazpacho.md
.
├── g
│   ├── cfg
│   │   ├── cfg.go
│   │   ├── cfg_test.go
│   │   └── testdata
│   └── lib.go
├── go.mod
├── go.sum
@vyskocilm
vyskocilm / worker-pool.go
Created Oct 10, 2018
Simple pool of goroutine workers with input/output channels
View worker-pool.go
// Worker pool example with input and output channel and multiple workers
// solves the deadlock caused by the r chanel not read on time, so blocking all
// worker on ri <- v
package main
import (
"fmt"
"time"
"sync"
@vyskocilm
vyskocilm / sl.sh
Created Sep 12, 2017
Show nth line with context 5 of each file
View sl.sh
#!/bin/bash
#
# Show nth line with context 5 of each file
#
show_lines ()
{
local file n ctx min max lineno star
file=${1}
View buildzmq.sh
#!/bin/bash
# build ZeroMQ stack and install to /usr/local/
die () {
echo "FATAL: $@" >&2
exit 1
}
touch /usr/local/_test || die "Make /usr/local accessible again (chmod a+rwx)"