Skip to content

Instantly share code, notes, and snippets.

View satbirdd's full-sized avatar

liu lei satbirdd

  • Changsha, China
View GitHub Profile
@satbirdd
satbirdd / bytes_split.go
Created October 25, 2017 01:38 — forked from xlab/bytes_split.go
Golang split byte slice in chunks sized by limit
func split(buf []byte, lim int) [][]byte {
var chunk []byte
chunks := make([][]byte, 0, len(buf)/lim+1)
for len(buf) >= lim {
chunk, buf = buf[:lim], buf[lim:]
chunks = append(chunks, chunk)
}
if len(buf) > 0 {
chunks = append(chunks, buf[:len(buf)])
}
@satbirdd
satbirdd / golang-gql-client.go
Created September 7, 2017 06:41 — forked from rms1000watt/golang-gql-client.go
Golang GraphQL Client
package main
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"strconv"
)
@satbirdd
satbirdd / Ubuntu12.04-g++4.8
Created April 23, 2016 05:41 — forked from akoluthic/Ubuntu12.04-g++4.8
Install g++ 4.8 on Ubuntu 12.04
*Add the toolchain/test PPA*
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.8
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
*If you ever want to update symlinks for a future version:*
sudo rm /usr/bin/g++
sudo ln -s /usr/bin/g++-4.XXX /usr/bin/g++