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
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 / 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 / .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"
@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)
@metakeule
metakeule / mapreduce.js
Created July 17, 2012 03:06 — forked from madhums/mapreduce.js
mapreduce using mongodb and mongoose
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/db_name');
// map function
var map = function(){
emit(this.field_to_group_by, {
other_fields: this.other_fields
// list other fields like above to select them
})
}
@metakeule
metakeule / test.js
Created June 18, 2012 11:01 — forked from youurayy/test.js
Testing overloadability of native Object members
var ps = [
'__defineGetter__', '__defineSetter__', 'valueOf',
'__lookupGetter__', '__lookupSetter__',
'constructor', 'hasOwnProperty',
'isPrototypeOf', 'propertyIsEnumerable',
'toLocaleString', 'toString' ];
var o = {};
for(var i = 0; i < ps.length; i++)
@metakeule
metakeule / gist:2803223
Created May 27, 2012 10:32
clone an heroku app on a linux machine
# install git
# setup your global git config
# then generate a public key with ssh-keygen
# setup and install your ruby and gems
gem install foreman
gem install heroku
heroku login
heroku keys:add
git clone git@heroku.com:your-app.git
@metakeule
metakeule / observer.md
Created May 10, 2012 13:24 — forked from lloyd/observer.md
BrowserID Observer API

BrowserID "Observer" API

The BrowserID JavaScript API can be used by web pages to implement BrowserID authentication. Implementing BrowserID support consists of:

  1. registering callback functions that will be invoked when the user logs in or out via navigator.id.watch()
  2. invoking navigator.id.request() when the user clicks a login button on your site.
  3. invoking navigator.id.logout() when the user clicks a logout button on your site.