Skip to content

Instantly share code, notes, and snippets.

import requests
from flask import Flask
from flask import request, jsonify
import pdb
# Flask constructor takes the name of
# current module (__name__) as argument.
app = Flask(__name__)
EDOS_ENDPOINT = "https://localhost:8091"
# The route() function of the Flask class is a decorator,
package pool
import (
"container/list"
"errors"
"sync"
"fmt"
)
package server
import (
"errors"
"fmt"
"io"
"io/ioutil"
"time"
log "github.com/sirupsen/logrus"
package main
import (
"bufio"
"encoding/json"
"log"
"os"
"sync"
)
package main
import (
"fmt"
"io/ioutil"
"log"
)
func main() {
files, err := ioutil.ReadDir("/data/cdrs/cv2/swoffnet/alliance/")
package main
import (
"database/sql"
"fmt"
"log"
"os"
"sync"
"time"
@meetme2meat
meetme2meat / unmarshal_interface.go
Created September 23, 2019 14:06 — forked from tkrajina/unmarshal_interface.go
Unmarshal JSON to specific interface implementation
package main
import (
"encoding/json"
"fmt"
"reflect"
)
type Something interface{}
@meetme2meat
meetme2meat / gist:ed1223b7f9675243b9e0da082726fe2e
Created February 3, 2019 05:07 — forked from pbailis/gist:5660980
Assorted distributed database readings

Context: I was asked for a list of interesting reading relating to "distributed databases, behavior under partitions and failures, failure detection." Here's what I came up with in about an hour.

For textbooks, "Introduction to Reliable and Secure Distributed Programming" is a superb introduction to distributed computing from a formal perspective; it's really not about "programming" or "engineering" but about distributed system fundamentals like consensus, distributed registers, and broadcast. Used in Berkeley's Distributed Computing course (and HT to @lalithsuresh) Book Site

Notes from courses like Lorenzo Alvisi's Distributed Computing class can be great.

There are a bunch of classics on causality, [Paxos](ht

## following is a simple cicruit breaker implementation with thread support.
## https://github.com/soundcloud/simple_circuit_breaker/blob/master/lib/simple_circuit_breaker.rb
class CircuitBreaker
class Error < StandardError
end
def initialize(retry_timeout=10, threshold=30)
@mutex = Mutex.new
@retry_timeout = retry_timeout
@threshold = threshold
local ltn12 = assert(require('ltn12'))
local cjson = assert(require('cjson'))
local http = assert(require('socket.http'))
-- local dbg = assert(require('debugger'))
-- local signal = require("posix.signal")
-- signal.signal(signal.SIGINT, function(signum)
-- io.write("\n")
-- -- put code to save some stuff here
-- os.exit(128 + signum)