Skip to content

Instantly share code, notes, and snippets.

View sajal's full-sized avatar
💭
What's happening?

Sajal Kayan sajal

💭
What's happening?
View GitHub Profile
@sajal
sajal / rbdinfo.go
Created March 27, 2017 11:21
rbd info
package main
import (
"log"
"github.com/ceph/go-ceph/rados"
"github.com/ceph/go-ceph/rbd"
)
func main() {
package main
import (
"context"
"flag"
"fmt"
"log"
"net"
"net/http"
"net/http/httptest"
@sajal
sajal / buggy-also.go
Created December 8, 2016 10:28
map booboo
package main
import (
"sync"
"time"
)
// cache allows manipulating cached data.
type cache struct {
// Concurrent access control to maps
Dec 8 09:56:00 pulse cnc[3886]: 2016/12/08 09:56:00 warning: libgeoip lookup failed for ip '10.1.9.1'
Dec 8 09:56:00 pulse cnc[3886]: 2016/12/08 09:56:00 warning: libgeoip lookup failed for ip '192.168.2.254'
Dec 8 09:56:00 pulse cnc[3886]: 2016/12/08 09:56:00 warning: libgeoip lookup failed for ip '192.168.1.1'
Dec 8 09:56:00 pulse cnc[3886]: 2016/12/08 09:56:00 warning: libgeoip lookup failed for ip '10.0.1.254'
Dec 8 09:56:00 pulse cnc[3886]: 2016/12/08 09:56:00 (geoipdb) cache miss for 58.221.26.69
Dec 8 09:56:00 pulse cnc[3886]: fatal error: 2016/12/08 09:56:00 (geoipdb) cache miss for 217.170.0.244
Dec 8 09:56:00 pulse cnc[3886]: concurrent map writes
Dec 8 09:56:00 pulse cnc[3886]: goroutine 1936 [running]:
Dec 8 09:56:00 pulse cnc[3886]: runtime.throw(0x8b944e, 0x15)
Dec 8 09:56:00 pulse cnc[3886]: #011/usr/local/go/src/runtime/panic.go:566 +0x95 fp=0xc4209e1b08 sp=0xc4209e1ae8
@sajal
sajal / 16808.go
Created September 16, 2016 18:55
reproduction for Go issue #16808
package main
import (
"log"
"net"
"net/http"
"os"
"os/exec"
"strconv"
"time"

Keybase proof

I hereby claim:

  • I am sajal on github.
  • I am sajal (https://keybase.io/sajal) on keybase.
  • I have a public key whose fingerprint is A668 BBFE 438C BEDA 7BB6 3925 3964 90AC BF15 828F

To claim this, I am signing this object:

@sajal
sajal / README.md
Created March 27, 2015 15:48
Web browser example for RIPE ATLAS DNS

First run

npm install -g browserify
npm install -g native-dns-packet
browserify main.js > bundle.js
@sajal
sajal / ripe_abuf.js
Created March 27, 2015 15:43
Node.js example for RIPE ATLAS DNS result
var Packet = require('native-dns-packet');
var buf = new Buffer("f2+AgAABAAEAAAAAA3d3dwRyaXBlA25ldAAAAQABwAwAAQABAAA3+gAEwQAGiw==", 'base64');
var p = Packet.parse(buf)
console.log(p)
@sajal
sajal / ripe_abuf.go
Created March 27, 2015 15:40
Decode RIPE ATLAS DNS results.
package main
import (
"encoding/base64"
"fmt"
"github.com/miekg/dns"
)
func main() {
//Decode base64 to binary
@sajal
sajal / .config
Created February 25, 2015 16:46
gccgo on WT1520
#
# Automatically generated file; DO NOT EDIT.
# OpenWrt Configuration
#
CONFIG_MODULES=y
CONFIG_HAVE_DOT_CONFIG=y
# CONFIG_TARGET_ppc40x is not set
# CONFIG_TARGET_realview is not set
# CONFIG_TARGET_arm64 is not set
# CONFIG_TARGET_sunxi is not set