Skip to content

Instantly share code, notes, and snippets.

@herohenu
herohenu / read_line.go
Created July 19, 2018 13:05 — forked from kendellfab/read_line.go
Golang --> Read file line by line.
func readLine(path string) {
inFile, _ := os.Open(path)
defer inFile.Close()
scanner := bufio.NewScanner(inFile)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
fmt.Println(scanner.Text())
}
}
@herohenu
herohenu / gist:bd5c35a63f58a16ccf4ab3382ceab9ed
Created March 7, 2018 02:48 — forked from thomas11/gist:2909362
Log memory usage every n seconds in Go #golang
import (
"runtime"
"time"
)
...
go func() {
for {
var m runtime.MemStats
@herohenu
herohenu / gist:63fd54596ddb56e49ec47ef896b08f2d
Created May 26, 2016 06:14 — forked from the42/gist:1956518
GZip encoding for GO V1 using custom responsewriter
package main
import (
"compress/gzip"
"io"
"net/http"
"strings"
)
type gzipResponseWriter struct {
@herohenu
herohenu / multipart_upload.go
Created May 9, 2016 05:56 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
@herohenu
herohenu / ecb.go
Created April 8, 2016 07:00 — forked from DeanThompson/ecb.go
Golang AES ecb mode
package utils
import "crypto/cipher"
type ecb struct {
b cipher.Block
blockSize int
}
func newECB(b cipher.Block) *ecb {
@herohenu
herohenu / gist:2bd94589595c44459769
Created February 24, 2016 10:07
Sublime Text 3 Build 3083 License Key - CRACK
### yo probe esta:
—– BEGIN LICENSE —–
J2TeaM
2 User License
EA7E-940282
45CB0D8F 09100037 7D1056EB A1DDC1A2
39C102C5 DF8D0BF0 FC3B1A94 4F2892B4
0AEE61BA 65758D3B 2EED551F A3E3478C
C1C0E04E CA4E4541 1FC1A2C1 3F5FB6DB
54.234.135.251 get.docker.io
54.234.135.251 cdn-registry-1.docker.io
74.125.128.102 golang.org
174.129.25.170 vagrantup.com