Skip to content

Instantly share code, notes, and snippets.

// g++ -std=c++14 task.cc -pthread
#include <iostream>
#include <functional>
#include <future>
#include <thread>
#include <chrono>
#include <mutex>
#include <queue>
#include <memory>
#include <atomic>
/*
$ cc context.c && ./a.out
foo() - 1
bar() - 1
foo() - 2
bar() - 2
foo() - 3
bar() - 3
@Preetam
Preetam / Infimum.tmTheme
Created May 19, 2014 02:55
A minimal Sublime color scheme based on shades of gray
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>gutterSettings</key>
<dict>
<key>background</key>
<string>#FFFFFF</string>
<key>divider</key>
<string>#000000</string>

DigitalOcean 4 GB RAM droplet with SSD

root@test:~# ./listmap.test -test.v -test.bench="Benchmark.*" -test.benchtime=5s
=== RUN Test1
=== RUN Test2
=== RUN Test3
=== RUN TestRemove
=== RUN TestSequentialShort
--- PASS: TestSequentialShort (0.00 seconds)
package main
import (
"sync"
"testing"
)
// BenchmarkPanicRecovery 1000000 1025 ns/op
func BenchmarkPanicRecovery(b *testing.B) {
buffer := []byte{0, 1, 2, 3}
package main
import (
"github.com/PreetamJinka/sflow-go"
"github.com/PreetamJinka/udpchan"
"fmt"
"io/ioutil"
"net"
"runtime"
@Preetam
Preetam / deploy.php
Created July 21, 2014 01:39
KVM provisioning script :P
<?
$plans = array(
'tera' => array('12G', 256000, 2, '11750M'),
'peta' => array('25G', 512000, 4, '24500M'),
'exa' => array('50G', 1024000, 8, '49G'),
'zetta' => array('100G', 2048000, 8, '99G'),
'yotta' => array('200G', 4096000, 8, '199G')
);
$images = array(
#!/usr/bin/php
<?
$user = trim(`id -un`);
$hostname = trim(`hostname`);
declare(ticks = 1);
pcntl_signal(SIGTERM, "signal_handler");
pcntl_signal(SIGINT, "signal_handler");
function signal_handler($signal) {
package main
import (
"log"
"fmt"
"syscall"
"github.com/PreetamJinka/ethernetdecode"
)
package main
import (
"github.com/PreetamJinka/sflow-go"
"github.com/PreetamJinka/udpchan"
"fmt"
"log"
"net"
"time"