Skip to content

Instantly share code, notes, and snippets.

View urakozz's full-sized avatar
🎯
Focusing

Yury Kozyrev urakozz

🎯
Focusing
View GitHub Profile
@urakozz
urakozz / Container.go
Created December 14, 2015 16:54
Flat Buffers with Golang
// automatically generated, do not modify
package encoder
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type Container struct {
_tab flatbuffers.Table
}
@urakozz
urakozz / self_ssl.sh
Created July 17, 2015 14:06
Generate self_signed ssl
openssl genrsa -out example.com.key 2048
openssl req -new -x509 -key example.com.key -out example.com.cert -days 3650 -subj /CN=example.com
@urakozz
urakozz / read_write.go
Created July 12, 2015 20:43
Go read write channels
package main
import "fmt"
type Msg struct {
text int
}
func write(c chan <- interface{}) {
for i := 0; i < 7; i++ {
@urakozz
urakozz / go_debian.sh
Created July 7, 2015 16:57
Go debian
wget -O - https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | sudo tar -xzC /usr/local -f -
echo '# Setup for golang' |sudo tee /etc/profile.d/golang.sh
echo 'PATH=$PATH:/usr/local/go/bin'|sudo tee -a /etc/profile.d/golang.sh
source /etc/profile.d/golang.sh
@urakozz
urakozz / Vagrantfile
Created July 6, 2015 12:37
Vagrant slow network
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
@urakozz
urakozz / go_build.sh
Created June 26, 2015 13:14
Go build hard command
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -v -o application-name .
@urakozz
urakozz / vhost.conf
Last active August 29, 2015 14:23
Nginx proxy with keepalive connection
upstream service-keepalive {
server loadbalancer.aws.com:443 max_fails=0 fail_timeout=30s;
keepalive 1024;
}
server {
listen 8443;
server_name service.proxy.example.net;
location / {
@urakozz
urakozz / .gitconfig
Last active August 29, 2015 14:23
Multiple accounts + go fix
# ~/.ssh/config
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
Host github-kozz
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_kozz
@urakozz
urakozz / concurrency.go
Last active September 4, 2015 22:29
Go notes
func main(){
wg := &sync.WaitGroup{}
for i := 0; i < 10; i++ {
wg.Add(1)
go func(i int) {
defer wg.Done()
time.Sleep(time.Duration(rand.Intn(90)) * time.Millisecond)