Skip to content

Instantly share code, notes, and snippets.

Avatar

Andreas Garnaes andreas

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am andreas on github.
  • I am cuvius (https://keybase.io/cuvius) on keybase.
  • I have a public key ASALc5Ofk2xhHQbqvgqL0lYq6jA_TgvlJnOpKH0vrKTaOAo

To claim this, I am signing this object:

View ocaml-mariadb-osx.patch
diff --git bindings/ffi_bindings.ml bindings/ffi_bindings.ml
index 8a8cc5c..58725d7 100644
--- bindings/ffi_bindings.ml
+++ bindings/ffi_bindings.ml
@@ -44,16 +44,10 @@ module Types (F: Cstubs.Types.TYPE) = struct
let connect_attr_delete = constant "MYSQL_OPT_CONNECT_ATTR_DELETE" int
let server_public_key = constant "MYSQL_SERVER_PUBLIC_KEY" int
let enable_cleartext_plugin = constant "MYSQL_ENABLE_CLEARTEXT_PLUGIN" int
- let can_handle_expired_passwords =
- constant "MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS" int
View example.go
package main
import (
"fmt"
"github.com/andreas/podio-go"
)
func main() {
authToken, err := podio.AuthWithUserCredentials("my-client-id", "my-client-secret", "my-username", "my-password")
@andreas
andreas / main.go
Created Jun 9, 2016
This gist shows the impact of resolving fields in parallel in graphql-go.
View main.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"github.com/graphql-go/graphql"
)
@andreas
andreas / envelope_encryption.go
Created Feb 3, 2015
Envelope Encryption with Amazon KMS and Go
View envelope_encryption.go
package main
import (
"bytes"
"crypto/rand"
"encoding/gob"
"fmt"
"io/ioutil"
"os"
"time"
View bowling_scores.rb
# Start with these
[0, [0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0]]
[20, [1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1]]
# Games with a spare
[29, [5,5, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1]]
[38, [5,5, 1,9, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1]]
# Games with a strike
[30, [1,1, 10, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1]]
View memcached_test.ml
open Core.Std
open Async.Std
module Ints = struct
type t = int
let to_string = string_of_int
let of_string = int_of_string
end
module IntCache = Memcached.Make(Ints)
View gist:8844119
{"script":"(a+b)*c*d", "context": {"a": 3, "b": 5, "c": 7, "d": 11}}
@andreas
andreas / gist:5432990
Created Apr 22, 2013
Use [rblineprof](https://github.com/tmm1/rblineprof) for profiling Rails apps
View gist:5432990
class RBLineProfiler
WALL_TIME_LIMIT = 10e3 # ms
def initialize(app)
@app = app
end
def call(env)
result = nil
profile = lineprof(/./) { result = @app.call(env) }
View devise.da.yml
da:
errors:
messages:
not_found: "ikke fundet"
already_confirmed: "er allerede bekræftet"
not_locked: "var ikke låst"
devise:
failure:
unauthenticated: 'Du skal logge ind for at kunne fortsætte.'