Skip to content

Instantly share code, notes, and snippets.

View fatih's full-sized avatar

Fatih Arslan fatih

View GitHub Profile
@danp
danp / goimports
Last active September 10, 2015 14:24
godep-aware goimports and more
#!/bin/sh
# for use with emacs/vim/etc as goimports and goflymake
#
# I use it with config like:
#
# (setenv "GOPATH" (expand-file-name "~/Projects/go"))
# (setenv "PATH" "~/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/Projects/go/bin:/usr/local/go/bin")
# (setq exec-path (append exec-path (list (expand-file-name "~/Projects/go/bin") "/usr/local/go/bin")))
#
@elazarl
elazarl / redcon.go
Created June 6, 2011 08:45
redirect network stream
package main
import (
"log"
"io"
"os"
"crypto/tls"
"strings"
"net"
"flag"
@dreamiurg
dreamiurg / fabfile.py
Created July 25, 2011 08:40
fabfile.py for webfaction and vagrant
"""
This fabric file makes setting up and deploying a django application much
easier to webfaction servers or your dedicated server, but it does make a
few assumptions. Namely that you're using Git, Apache and mod_wsgi. Also
you should have SSH installed on both the local machine and any servers you
want to deploy to.
Thanks to:
http://github.com/ryanmark/django-project-templates
@michaelglass
michaelglass / Coffeescript ctags
Last active December 15, 2015 05:39 — forked from Gonzih/Coffeescript ctags
allow for default assignment in constructor
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/(^|=[ \t])*class ([A-Za-z]+\.)*([A-Za-z]+)( extends [A-Za-z_.]+)?$/\3/c,class/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?@?([A-Za-z_.]+):.*[-=]>.*$/\3/m,method/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?([A-Za-z_.]+)[ \t]+=.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*([A-Za-z_.]+)[ \t]+=[^->\n]*$/\1/v,variable/
--regex-coffee=/^[ \t]*@([A-Za-z_.]+)[ \t]+=[^->\n]*$/\1/f,field/
--regex-coffee=/^[ \t]*@([A-Za-z_.]+):[^->\n]*$/\1/f,static field/
--regex-coffee=/^[ \t]*([A-Za-z_.]+):[^->\n]*$/\1/f,field/
@jgrahamc
jgrahamc / slide10.go
Last active December 15, 2015 12:48
The code associated with this talk: http://www.slideshare.net/jgrahamc/go-oncurrency
func worker(die chan bool) {
for {
select {
// ... do stuff cases
case <- die:
return
}
}
}
import os
import sys
import threading
import zmq
def worker(identity, wurl):
ctx = zmq.Context.instance()
s = ctx.socket(zmq.REP)
s.identity = identity
@guelfey
guelfey / cover.vim
Created August 16, 2013 22:01
Vim plugin for Go test coverage profiles
" cover.vim - Vim plugin for Go test coverage profiles
" install in ftplugin/go
"
" ":Cover coverprofile" will open the current file in a new read-only window,
" highlighting the code regarding to whether it is covered by tests or not.
" You can change the colors by highlighting goTestCovered and goTestNotCovered
" from your vimrc.
if exists("b:did_ftplugin_go_cover")
finish
@border
border / Makefile
Created January 12, 2011 01:36
json example in golang
include $(GOROOT)/src/Make.inc
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
all:
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
format:
$(GOFMT) -w jsontest.go
@jonhoo
jonhoo / README.md
Last active July 19, 2021 10:49
Distributed RWMutex in Go
@anandkunal
anandkunal / simple_reverse_proxy.go
Created September 4, 2012 21:12
Simple reverse proxy in Go.
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
)
func main() {