Skip to content

Instantly share code, notes, and snippets.

Viren Negi meetme2meat

  • Mumbai
Block or report user

Report or block meetme2meat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
meetme2meat / unmarshal_interface.go
Created Sep 23, 2019 — forked from tkrajina/unmarshal_interface.go
Unmarshal JSON to specific interface implementation
View unmarshal_interface.go
package main
import (
type Something interface{}
meetme2meat / gist:ed1223b7f9675243b9e0da082726fe2e
Created Feb 3, 2019 — forked from pbailis/gist:5660980
Assorted distributed database readings
View gist:ed1223b7f9675243b9e0da082726fe2e

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

View simple_circuit_breaker.rb
## following is a simple cicruit breaker implementation with thread support.
class CircuitBreaker
class Error < StandardError
def initialize(retry_timeout=10, threshold=30)
@mutex =
@retry_timeout = retry_timeout
@threshold = threshold
View parse.lua
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)
View main.rb
require 'bundler'
require 'ffi-rzmq'
require 'celluloid/zmq'
require 'celluloid/current'
require 'securerandom'
class SockOne
include Celluloid::ZMQ
attr_reader :sock
View activerecord.rb
### A quick dirty fix.
## Current version ActiveRecord 4.2.0
## Jruby
## Avoid some Mutex lock. Reference issue ->
## Why we need this.
## Since we cant upgrade to 5.2.stable because the JDBC driver support are still not mature and the 5.0.x is causing some strange
## error (which I seem is fixed only in 5.2.stable)
class Handler
meetme2meat / Gemfile
Created Feb 20, 2018 — forked from karmi/Gemfile
Sinatra + EventSource JavaScript Streaming
View Gemfile
source ""
gem "sinatra", "~> 1.3.0"
gem "thin"
View reconnect_pg_with_connection_pool.rb
## Tested under Jruby and Connection Pool 2.2.1
## jruby (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 25.144-b01 on 1.8.0_144-b01 +jit [darwin-x86_64]
require 'pg'
require 'colorize'
require 'connection_pool'
require 'securerandom'
$db_options = {user: 'postgres', dbname: 'postgres'}
class ScpLookup
attr_reader :pg_conn, :db_options
def initialize(db_options)
meetme2meat / requestor.awk
Created Nov 17, 2017 — forked from sinegar/requestor.awk
Combine tcpdump packets into requests and response times.
View requestor.awk
#!/usr/bin/awk -f
# #
# Inspired by
# Example usage:
# $ tcpdump -i any -s 0 -nnq -tt 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
# 1349692787.492311 IP X.X.X.X.XXXX > X.X.X.X.XXXX: tcp 1448
# $ ./requestor.awk dump.file
meetme2meat / call-apply-bind-proxy.js
Created Sep 26, 2016 — forked from branneman/call-apply-bind-proxy.js
JavaScript call() vs apply() vs bind() vs $.proxy()
View call-apply-bind-proxy.js
var fn = function(arg1, arg2) {
var str = '<p>aap ' + this.noot + ' ' + arg1 + ' ' + arg2 + '</p>';
document.body.innerHTML += str;
var context = {
'noot': 'noot'
var args = ['mies', 'wim'];
// Calls a function with a given 'this' value and arguments provided individually.
You can’t perform that action at this time.