Skip to content

Instantly share code, notes, and snippets.

View hisusqristos's full-sized avatar

Varin. K hisusqristos

  • Powered by Love
  • 03:23 (UTC +04:00)
View GitHub Profile

Poor Man's Global Traffic Manager

Sometimes we need to add redundancy to some service or server which happen to be a public-facing entry point of our infrastructure. For example, imagine we want to add a high availability pair for a load balancer which sits on the edge of network and forwards traffic to alive backend servers.

                                             ┌─────────────┐
                                             │             │
                                      ┌─────►│  Backend 1  │
                                      │      │             │
                                      │      └─────────────┘
import scala.collection.mutable.Stack
class Peg(val disks: Stack[Int], val name: String)
def solveHanoi_1(n: Int): Unit = {
val A = Peg(Stack[Int](1 to n: _*), "A")
val B = Peg(Stack[Int](), "B")
val C = Peg(Stack[Int](), "C")
val evenSeq = Seq((A, B), (A, C), (B, C))
@pop3xrj
pop3xrj / gist:184976
Created September 11, 2009 00:56
postgresql db backup and pump into bz2
pg_dump -Unrcrm -h 192.168.x.x --exclude-table=public.foo --exclude-table=public.bar dbname | bzip2 -c > ~/file.bz2
bzip2 -d db.sql.bz2 |psql test test
SELECT relname, reltuples, relpages * 8 / 1024 AS "MB" FROM pg_class ORDER BY relpages DESC;