Skip to content

Instantly share code, notes, and snippets.

View samuraisam's full-sized avatar

Samuel Sutch samuraisam

View GitHub Profile
@samuraisam
samuraisam / migrate.go
Created August 5, 2016 23:52
database migrator in go
package dbutils
import (
"database/sql"
"log"
"regexp"
"sort"
)
// Direction is the migration direction (up or down usually)
@samuraisam
samuraisam / bip-http-address-service-suggestion.md
Last active June 27, 2016 22:13
Retrieving (Encrypted)ProtocolMessages via the HTTP Endpoint

Retrieving EncryptedProtocolMessages via the HTTP Endpoint

Clients can retrieve ProtocolMessages or EncryptedProtocolMessage awaiting them through the HTTP endpoint.

Request

A HTTP GET request on a TLS-protected HTTP address MUST set the Accept header to the requested content type (multipart/mixed). The X-Identity header MUST be set to the hex-encoded DER-formatted public key of the requestor. The X-Signature header MUST be set to the hex-encoded DER-encoded signature (described below). The Date header MUST be set according to RFC-2616 14.18.

X-Signature
enum BRBSPatchError: ErrorType {
case Unknown
case CorruptPatch
case PatchFileDoesntExist
case OldFileDoesntExist
}
class BRBSPatch {
static let patchLogEnabled = true
import Foundation
enum BRTarError: ErrorType {
case Unknown
case FileDoesntExist
}
enum BRTarType {
case File
case Directory
let BreadDefaultService = "org.voisine.breadwallet"
enum BRKeychainError: String, ErrorType {
// this is borrowed from the "Locksmith" library: https://github.com/matthewpalmer/Locksmith
case Allocate = "Failed to allocate memory."
case AuthFailed = "Authorization/Authentication failed."
case Decode = "Unable to decode the provided data."
case Duplicate = "The item already exists."
case InteractionNotAllowed = "Interaction with the Security Server is not allowed."
case NoError = "No error."
#!/bin/bash
# this script will run only once. it is to be placed in the /etc/init.d/ directory
# it will create an ebs volume and mount it
# add it to /etc/init.d/mounter
# and run sudo update-rc.d mounter defaults
# to make it run on boot
FLAG="/var/log/mounter.log"
if [ ! -f $FLAG ]; then
require 'webrick'
require 'json'
require_relative 'health_reporter'
module Geronimo
# Geronimo::HealthServer is a HTTP server which is intended to run alongside
# services which do not have an HTTP server.
#
# For example, a service like Sidekiq might extend the class to offer
# health checks related to Sidekiq functions
import psycopg2
import uuid
import json
conn = psycopg2.connect('dbname=ftest user=ffer password=omgnowai')
cur = conn.cursor()
cur.execute('DROP TABLE IF EXISTS entries')
cur.execute('''
CREATE TABLE entries (
id serial PRIMARY KEY,
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['modal'],
didInsertElement: function() {
var self = this.$();
Ember.run.later(function() {
self.toggleClass('open');
});
960a14a3b6c5b785ca2c027d9461374a