Skip to content

Instantly share code, notes, and snippets.

Ido Kanner ik5

  • :::1
Block or report user

Report or block ik5

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ericbn
ericbn / .vimrc
Last active Nov 22, 2019
Vim Powerline-like status line without the need of any plugin
View .vimrc
" Statusline (requires Powerline font)
set statusline=
set statusline+=%(%{&buflisted?bufnr('%'):''}\ \ %)
set statusline+=%< " Truncate line here
set statusline+=%f\ " File path, as typed or relative to current directory
set statusline+=%{&modified?'+\ ':''}
set statusline+=%{&readonly?'\ ':''}
set statusline+=%= " Separation point between left and right aligned items
set statusline+=\ %{&filetype!=#''?&filetype:'none'}
set statusline+=%(\ %{(&bomb\|\|&fileencoding!~#'^$\\\|utf-8'?'\ '.&fileencoding.(&bomb?'-bom':''):'')
@yalesov
yalesov / bit.rb
Last active Sep 1, 2016
Ruby bitwise flag manipulation
View bit.rb
# ===== #
# Flags #
# ===== #
# say, a 1 byte integer
#
# 0 0 0 0 0 0 0 0
# |- position 0
# |--- position 1
# |----- position 2
@teddyking
teddyking / waitgroup.go
Created Aug 23, 2016
Example of Go sync.WaitGroup
View waitgroup.go
package main
import (
"fmt"
"sync"
"time"
)
func main() {
var myWaitGroup sync.WaitGroup
@sethwebster
sethwebster / GoDaddySSLHAProxy.md
Created Dec 29, 2015
Creating a PEM for HaProxy from GoDaddy SSL Certificate
View GoDaddySSLHAProxy.md

GoDaddy SSL Certificates PEM Creation for HaProxy (Ubuntu 14.04)

1 Acquire your SSL Certificate

Generate your CSR This generates a unique private key, skip this if you already have one.

sudo openssl genrsa -out  etc/ssl/yourdomain.com/yourdomain.com.key 1024

Next generate your CSR (Certificate Signing Request), required by GoDaddy:

@zchee
zchee / cgo.md
Last active Jan 16, 2020
cgo convert list
View cgo.md

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.

@patik
patik / how-to-squash-commits-in-git.md
Last active Jan 14, 2020
How to squash commits in git
View how-to-squash-commits-in-git.md

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@svett
svett / searchr.go
Created Jul 11, 2015
searchr - a sample application that works with pipes
View searchr.go
package main
import (
"bufio"
"flag"
"fmt"
"io"
"os"
"strings"
)
View The Three Go Landmines.markdown

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@alecthegeek
alecthegeek / go-install-tools
Last active Sep 3, 2015
Set up a "standard" go project workspace with support for 3rdparty modules, version control repo and a template main package
View go-install-tools
# Install all the Go tools and godep tool
# Location of gobin is based on installation by OS X Homebrew
sudo -u admin GOPATH=/tmp GOBIN=/usr/local/opt/go/bin go get -u golang.org/x/tools/cmd/...
sudo -u admin GOPATH=/tmp GOBIN=/usr/local/opt/go/bin go get -u github.com/tools/godep
@milosgajdos83
milosgajdos83 / gist:9f68b1818dca886e9ae8
Last active Dec 1, 2019
Add a VLAN interfaces into Docker from the host machine
View gist:9f68b1818dca886e9ae8
package main
import (
"fmt"
"log"
"net"
"github.com/milosgajdos83/tenus"
)
You can’t perform that action at this time.