Skip to content

Instantly share code, notes, and snippets.

View fatih's full-sized avatar

Fatih Arslan fatih

View GitHub Profile
" Copyright 2013 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" compiler/go.vim: Vim compiler file for Go.
if exists("current_compiler")
finish
endif
let current_compiler = "go"
"this produces an output like:
" /path/file1.txt
" /path/file2.txt
" /path/file3.txt
function! GoFiles()
let out=system("go list -f $'{{range $f := .GoFiles}}{{$.Dir}}/{{$f}}\n{{end}}'")
echo out
endfunction
" check for ctags folder, if not exist extract our ctags binary
if !isdirectory(expand("$HOME/.vim/binary/ctags/"))
let ctags_bottle_dir = expand("$HOME/.vim/binary/")
let ctags_bottle_file = expand("$HOME/.vim/binary/ctags-5.8.mountain_lion.bottle.tar.gz")
execute "cd ".ctags_bottle_dir
execute "!tar xfv ".ctags_bottle_file
endif
@fatih
fatih / ring.go
Created December 24, 2013 00:47
container/ring example golang
package main
import (
"container/ring"
"fmt"
"time"
)
func main() {
coffee := []string{"kenya", "guatemala", "ethiopia"}
@fatih
fatih / attachTest.go
Last active December 26, 2015 22:29
Attach failing for arguments more than two
package main
import (
"fmt"
"github.com/caglar10ur/lxc"
)
func main() {
// first create and start
l := lxc.NewContainer("testing")
@fatih
fatih / set.go
Created August 11, 2013 21:05
Concurrent safe SET data structure in Go (Golang)
// A very simple example about how to use concurrent-safe SETs (using string as keys) in GO
package main
import (
"fmt"
"sync"
)
type Set struct {
m map[string]bool
@fatih
fatih / zmq-REP-client.go
Created July 16, 2013 09:03
Zmq REP client
package main
import (
zmq "github.com/pebbe/zmq3"
)
func main() {
responder, _ := zmq.NewSocket(zmq.REP)
defer responder.Close()
responder.SetIdentity("1123581321") //key to be used
@fatih
fatih / zmq-REQ-client.go
Created July 16, 2013 08:57
Zmq REQ Client
package main
import (
"fmt"
zmq "github.com/pebbe/zmq3"
"log"
)
func main() {
requester, _ := zmq.NewSocket(zmq.REQ)
@fatih
fatih / zmq-ROUTER-ROUTER.go
Last active December 19, 2015 19:38
Zmq ROUTER-ROUTER via zmq3 golang
package main
import (
"fmt"
zmq "github.com/pebbe/zmq3"
"log"
)
func main() {
var err error
@fatih
fatih / gist:5764501
Created June 12, 2013 11:24
Example document (mongodb)
{
"_id" : ObjectId("51b8582110b7fc5960000001"),
"docname" : "foo",
"entries" : {
"example-123" : {
"enabled" : true,
"mode" : "bar",
"entryname" : "example-123"
}
}