Skip to content

Instantly share code, notes, and snippets.

@andreas
andreas / envelope_encryption.go
Created February 3, 2015 19:25
Envelope Encryption with Amazon KMS and Go
package main
import (
"bytes"
"crypto/rand"
"encoding/gob"
"fmt"
"io/ioutil"
"os"
"time"
require 'RMagick'
class WatermarkMe
def initialize(app, args)
@app = app
@watermark_text, @mime_types = *args
@mime_types ||= %w[image/jpeg image/png image/gif]
end
def call(env)

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:

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
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 June 9, 2016 10:55
This gist shows the impact of resolving fields in parallel in graphql-go.
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"github.com/graphql-go/graphql"
)
@andreas
andreas / gist:5432990
Created April 22, 2013 07:14
Use [rblineprof](https://github.com/tmm1/rblineprof) for profiling Rails apps
class RBLineProfiler
WALL_TIME_LIMIT = 10e3 # ms
def initialize(app)
@app = app
end
def call(env)
result = nil
profile = lineprof(/./) { result = @app.call(env) }
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.'
From e6ec1f637ab3d6c235eef05142abf373e08f5c4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20Garn=C3=A6s?= <andreas.garnaes@gmail.com>
Date: Thu, 2 Sep 2010 12:35:37 +0200
Subject: [PATCH] ActiveModel#to_xml fix (renamed parameter).
---
activemodel/lib/active_model/serializers/xml.rb | 2 +-
activeresource/test/cases/base_test.rb | 6 ++++++
2 files changed, 7 insertions(+), 1 deletions(-)
# 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]]