Skip to content

Instantly share code, notes, and snippets.

@algrebe
algrebe / venv3.sh
Created October 6, 2018 00:07
Simple wrapper over python3's venv
#!/bin/bash
venvs=$HOME/.venv3
mkdir -p $venvs
venv3_mk() {
if [ "$#" -ne 1 ]
then
echo "Usage: venv3_mk <venv_name>"
return 1
@algrebe
algrebe / labels.json
Created February 22, 2017 08:52
Migrate labels for an existing github repository. Inspired by https://github.com/jasonbellamy/git-label
{"color": "bfd4f2", "name": "Effort: High"}
{"color": "f9d0c4", "name": "Effort: Low"}
{"color": "0e8a16", "name": "Effort: Medium"}
{"color": "1d76db", "name": "Impact: High"}
{"color": "0e8a16", "name": "Impact: Low"}
{"color": "bfdadc", "name": "Impact: Medium"}
{"color": "159818", "name": "Status: Help wanted", "old_name": "help wanted"}
{"color": "ededed", "name": "Status: In progress", "old_name": "in progress"}
{"color": "e6e6e6", "name": "Status: Needs review", "old_name": "needs review"}
{"color": "e5987b", "name": "Status: Needs revision"}
@algrebe
algrebe / gnsq_bug_output.txt
Created October 28, 2016 06:57
output from script to reproduce gnsq bug for issue https://github.com/wtolson/gnsq/issues/12
# output for https://github.com/wtolson/gnsq/issues/12
$ bash run.sh nsq-0.3.8.linux-amd64.go1.6.2/bin/
[nsqd] 2016/10/28 12:00:04.257878 nsqd v0.3.8 (built w/go1.6.2)
[nsqd] 2016/10/28 12:00:04.258187 ID: 433
[nsqd] 2016/10/28 12:00:04.258302 NSQ: persisting topic/channel metadata to nsqd.433.dat
[nsqd] 2016/10/28 12:00:04.262666 TCP: listening on [::]:4150
[nsqd] 2016/10/28 12:00:04.263643 HTTP: listening on [::]:4151
2016/10/28 12:00:06 INF 1 [TestTopic/default] (127.0.0.1:4150) connecting to nsqd
[nsqd] 2016/10/28 12:00:06.256774 TCP: new client(127.0.0.1:53323)
@algrebe
algrebe / resalloc.go
Created June 17, 2016 16:33
a resource allocation server using bleve.
// resource allocation server
/*
put in resources with tags such as
{ "ID": "some-id", "tags": []string{ "computer", "windows" } }
and if you want a computer that does not use windows
query for a resource using a string such as "+computer -windows"
*/
package resalloc
import (
@algrebe
algrebe / feedparser_test.py
Created May 6, 2016 12:27
testing feedparser
# -*- coding: UTF-8 -*-
raw_data = """
<?xml version="1.0" encoding="ISO-8859-2"?>
<rss version="2.0">
<channel>
<link>http://forum.gazeta.pl</link>
@algrebe
algrebe / goroutine_test.go
Created April 18, 2016 15:10
checking goroutines on a system
package main
import (
"fmt"
"runtime"
"time"
)
func do() {
for {
@algrebe
algrebe / persistent_chaining.go
Created January 13, 2016 17:42
gist for github.com/spf13/cobra describing the use of persistent chaining
package main
import (
"fmt"
"github.com/spf13/cobra"
)
func getFunc(msg string) func(*cobra.Command, []string) {
return func(cmd *cobra.Command, args []string) {
fmt.Printf("%s with args %v\n", msg, args)
@algrebe
algrebe / test-cobra-chain.go
Created January 8, 2016 06:54
golang example to test chaining
package main
import (
"fmt"
"github.com/algrebe/cobra"
)
func getFunc(msg string) func(*cobra.Command, []string) {
return func(cmd *cobra.Command, args []string) {
fmt.Printf("%s with args %v\n", msg, args)
@algrebe
algrebe / vmi_ugorji_msgpack.go
Created December 30, 2015 07:18
a comparison of vmihailenco and ugorji msgpack encoding of float
package main
import (
"fmt"
"github.com/ugorji/go/codec"
"gopkg.in/vmihailenco/msgpack.v2"
)
type TestStruct struct {
Num float32