Skip to content

Instantly share code, notes, and snippets.

View metakeule's full-sized avatar
💭
I may be slow to respond.

metakeule metakeule

💭
I may be slow to respond.
  • Asunción / Paraguay
View GitHub Profile
@metakeule
metakeule / postgres.go
Created April 12, 2018 04:46 — forked from rivo/postgres.go
A demo Go application (a PostgreSQL database browser) highlighting the use of the rivo/tview package. See https://github.com/rivo/tview/wiki/Postgres
package main
import (
"database/sql"
"fmt"
"net/url"
"os"
"reflect"
"regexp"
"strconv"
@metakeule
metakeule / main.cpp
Created April 4, 2018 06:18 — forked from cfillion/main.cpp
Bare-bone REAPER extension (prints Hello World! using the API)
// Bare-bone REAPER extension
//
// 1. Grab reaper_plugin.h from https://raw.githubusercontent.com/reaper-oss/sws/master/reaper/reaper_plugin.h
// 2. Grab reaper_plugin_functions.h by running the REAPER action "[developer] Write C++ API functions header"
// 3. Grab WDL: git clone https://github.com/justinfrankel/WDL.git
// 4. Build then copy or link the binary file into <REAPER resource directory>/UserPlugins
//
// Linux
// =====
//
@metakeule
metakeule / main.go
Created January 20, 2015 10:10
simple example how to use azul3d.org/audio
// simple example how to use azul3d.org/audio
//
// run it with SoX
// go run main.go | play -
//
// or save it to a file
// go run main.go > test.wav
//
package main
@metakeule
metakeule / errloop.sublime-snippet
Created January 14, 2015 11:22
snippet for error loop, put it somewhere beneath ~/.config/sublime-text-3/Packages/User
<snippet>
<content><![CDATA[
var (
// define the variables here that are shared along the steps
// most variables should only by defined by the type here
// and are assigned inside the steps
err error
${1:}
)
@metakeule
metakeule / main.go
Created January 14, 2015 11:18
benchmark error loops
package main
import (
"errors"
)
var Err = errors.New("test err")
func addOne(y, x int) (int, error) {
if x%y == 0 {
@metakeule
metakeule / index.html
Created May 19, 2014 23:10
A Pen by Secret Sam.
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<!-- Latest compiled and minified CSS -->
@metakeule
metakeule / .gtkrc-2.0
Created September 5, 2013 12:26
set foreground and background colors in claws mail list view (and other apps that use GtkSCTree from an gtk2 theme, stolen from http://crunchbang.org/forums/viewtopic.php?id=1821 setup your ~/.gtkrc-2.0 file
style "claws-folder-view" {
fg[NORMAL] = "#ffffff"
fg[ACTIVE] = "#ffffff"
fg[INSENSITIVE] = "#D5DCE0"
fg[PRELIGHT] = "#ffffff"
fg[SELECTED] = "#ffffff"
bg[ACTIVE] = "#7CA4CF"
bg[NORMAL] = "#686B6D"
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@metakeule
metakeule / limit.sql
Created April 12, 2013 07:48
Limit connections to postgres server in go, still PQ: TOO MANY CONNECTIONS FOR ROLE "USERNAME" errors popup
-- limit the number of connections, username is allowed to use
ALTER Role username CONNECTION LIMIT 10;
@metakeule
metakeule / gist:4623836
Created January 24, 2013 16:02
combine methods and functions that have the same primary argument, i.e. handle methods that are defined with the object and functions that are defined afterwards for this object (in another library) the same way.
package main
import "fmt"
type Foo struct{}
func (f *Foo) Method() {
fmt.Println("Method")
}
type Funcs []func(*Foo)