Skip to content

Instantly share code, notes, and snippets.

View nbari's full-sized avatar
🪴

nbari

🪴
View GitHub Profile
/* ivan(a.t)mysqlab.net */
package main
import (
"syscall"
"os"
"log"
)
func daemon(nochdir, noclose int) int {
@nbari
nbari / pr.md
Created June 5, 2016 17:19 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

Hardware : MT6582 (MT8382 is Fake!)
Model : GEN610
Build number : MT83X2_MR606_MZ6062H6CW1.2015092114
Build date UTC : 20150921-065038
Android v : 4.4.2
Baseband v: MOLY.WR8.W1315.MD.WG.MP.V35.P4, 2015/03/31 10:32
Kernel v : 3.4.67 (lyl@elink103) (gcc version 4.7 (GCC) ) #1 SMP Mon Sep 21 14:47:33 CST 2015
@nbari
nbari / proxy.go
Created March 20, 2016 09:28 — forked from vmihailenco/proxy.go
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
@nbari
nbari / udpProxy.go
Created March 18, 2016 14:51 — forked from mike-zhang/udpProxy.go
Implementation of a UDP proxy in Golang
// Implementation of a UDP proxy
package main
import (
"flag"
"fmt"
"log"
"net"
"os"
score-api:
url: http://127.0.0.1:8000/_healtcheck_
expect:
status: 200
if_not:
cmd: sv restart /service/score-api
notify: "your@team"
@nbari
nbari / Makefile
Created January 25, 2016 12:00
make & gnumake compatible
.PHONY: all test
all: test
test:
@if test -n "${BRANCH}"; then \
if test "${BRANCH}" = "master"; then echo "build master"; fi; \
fi;
@nbari
nbari / email_test.go
Created January 22, 2016 23:21 — forked from tmichel/email_test.go
Sending and testing email in Go -- appendix
package email
import (
"net/smtp"
"testing"
)
type EmailConfig struct {
Username string
Password string
@nbari
nbari / observer.go
Last active January 19, 2016 15:21
observer pattern in go
package main
import (
"fmt"
"sync"
"time"
)
type Producer struct {
chs []chan<- int
@nbari
nbari / fanout.go
Last active January 19, 2016 13:14
Fan-Out golang
package main
import (
"fmt"
"sync"
"time"
)
type myStruct struct {
key int