Skip to content

Instantly share code, notes, and snippets.

View fatih's full-sized avatar

Fatih Arslan fatih

View GitHub Profile
@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"}
" 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
"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
" 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"
let data = ['func Split(s string, sep string) []string', 'func SplitAfter(s string, sep string) []s
tring', 'func SplitAfterN(s string, sep string, n int) []string', 'func SplitN(s string,
sep string, n int) []string']
let wordMatch = "'\<" . expand("<cword>") . "\>'"
let filtered = filter(infos, 'v:val !~ ' . wordMatch)
echo filtered
@fatih
fatih / gist:cd1ee734803f27526f74
Created August 7, 2014 22:55
CoreOS Cloudformation with VPC
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "CoreOS on EC2: http://coreos.com/docs/running-coreos/cloud-providers/ec2/",
"Mappings" : {
"RegionMap" : {
"ap-northeast-1" : {
"AMI" : "ami-19fba518"
},
@fatih
fatih / go
Created September 25, 2014 09:58
Temp Private and Public Key generation
package sshutil
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"errors"
"fmt"
@fatih
fatih / sum
Created October 15, 2014 12:03
fun main(numbers: int list) =
let
fun sum(numbers: int list) =
if null numbers
then 0
else hd numbers + sum (tl numbers)
in
sum(numbers)
end
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
},
"builders": [
{
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"ami_name": "latest-{{timestamp}}",
@fatih
fatih / yamux-exmaple.go
Created May 22, 2015 10:19
A simple working yamux example
package main
import (
"fmt"
"log"
"net"
"time"
"github.com/hashicorp/yamux"
)