Skip to content

Instantly share code, notes, and snippets.

View dlsniper's full-sized avatar

Florin Pățan dlsniper

View GitHub Profile
@dlsniper
dlsniper / log.txt
Created February 21, 2018 22:10
IDEA
2018-02-21 22:07:56,562 [ 0] INFO - #com.intellij.idea.Main - ------------------------------------------------------ IDE STARTED ------------------------------------------------------
2018-02-21 22:07:56,719 [ 157] INFO - #com.intellij.idea.Main - IDE: IntelliJ IDEA (build #IU-181.3870.7, 20 Feb 2018 14:56)
2018-02-21 22:07:56,719 [ 157] INFO - #com.intellij.idea.Main - OS: Windows 10 (10.0, amd64)
2018-02-21 22:07:56,719 [ 157] INFO - #com.intellij.idea.Main - JRE: 1.8.0_152-release-1136-b11 (JetBrains s.r.o)
2018-02-21 22:07:56,719 [ 157] INFO - #com.intellij.idea.Main - JVM: 25.152-b11 (OpenJDK 64-Bit Server VM)
2018-02-21 22:07:56,720 [ 158] INFO - #com.intellij.idea.Main - JVM Args: -Xms128m -Xmx750m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -XX:MaxJavaStac
@dlsniper
dlsniper / gopath.txt
Created February 10, 2018 10:54
my GOPATH (windows)
florin@laptop [08:47:45 AM] [~/go/src]
-> % cloc .
322132 text files.
201053 unique files.
182638 files ignored.
github.com/AlDanial/cloc v 1.76 T=2901.86 s (48.8 files/s, 17833.0 lines/s)
----------------------------------------------------------------------------------------
Language files blank comment code
----------------------------------------------------------------------------------------
@dlsniper
dlsniper / gopath.txt
Created February 8, 2018 18:03
my GOPATH
florin@laptop [05:40:58 PM] [~/go/src]
-> % cloc .
486610 text files.
238318 unique files.
312871 files ignored.
github.com/AlDanial/cloc v 1.75 T=819.77 s (215.7 files/s, 70829.6 lines/s)
----------------------------------------------------------------------------------------
Language files blank comment code
----------------------------------------------------------------------------------------
@dlsniper
dlsniper / Dockerfile
Last active June 27, 2018 07:06
Dockerfile to test your Go code with the latest version of Go 1.10
FROM golang:1.10beta2
ADD . /go/src/github.com/<user>/<repo>
WORKDIR /go/src/github.com/<user>/<repo>
RUN go test -coverpkg=all -coverprofile cover.out ./...
@dlsniper
dlsniper / limited-concurrency.go
Created October 14, 2017 08:31
Go limited worker count
package main
import (
"fmt"
"runtime"
"sync"
)
func doStuff(wg *sync.WaitGroup, guard chan struct{}, id int) {
defer func() {
@dlsniper
dlsniper / cross-compile-go.bash
Created October 13, 2017 21:45
Cross compile Go for Raspberry Pi 3
cd ~
git clone git@github.com:golang/go.git gotip
cd gotip/src
export GOROOT_BOOTSTRAP=/usr/local/go
env GOOS=linux GOARCH=arm GOARM=7 ./make.bash
0x0000 00000 (/home/florin/go/src/github.com/dlsniper/u/tmp/asd/de.go:16) TEXT "".cl(SB), $120-8
0x0000 00000 (/home/florin/go/src/github.com/dlsniper/u/tmp/asd/de.go:16) MOVQ (TLS), CX
0x0009 00009 (/home/florin/go/src/github.com/dlsniper/u/tmp/asd/de.go:16) CMPQ SP, 16(CX)
0x000d 00013 (/home/florin/go/src/github.com/dlsniper/u/tmp/asd/de.go:16) JLS 359
0x0013 00019 (/home/florin/go/src/github.com/dlsniper/u/tmp/asd/de.go:16) SUBQ $120, SP
0x0017 00023 (/home/florin/go/src/github.com/dlsniper/u/tmp/asd/de.go:16) MOVQ BP, 112(SP)
0x001c 00028 (/home/florin/go/src/github.com/dlsniper/u/tmp/asd/de.go:16) LEAQ 112(SP), BP
0x0021 00033 (/home/florin/go/src/github.com/dlsniper/u/tmp/asd/de.go:16) FUNCDATA $0, gclocals·5f7ae22b544db82d5d4c812af83655e9(SB)
0x0021 00033 (/home/florin/go/src/github.com/dlsniper/u/tmp/asd/de.go:16) FUNCDATA $1, gclocals·bdf35
#!/usr/bin/env bash
echo "Creating GOPATH for issue 3960..."
echo "This will create a folder named gopath3960"
read -p "Are you sure? " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
@dlsniper
dlsniper / container-settings.json
Created June 18, 2017 16:51
Gogland container settings
{
"_comment": "FOR DETAILED FORMAT LOOK AT https://docs.docker.com/engine/api/v1.22/#create-a-container",
"AttachStdin": true,
"OpenStdin": true,
"HostConfig": {
"PortBindings":{
"8000/tcp": [{ "HostIp": "0.0.0.0", "HostPort": "8000" }],
"40000/tcp": [{ "HostIp": "0.0.0.0", "HostPort": "40000" }]
},
"SecurityOpt": ["apparmor=unconfined"],
@dlsniper
dlsniper / Dockerfile
Created June 18, 2017 16:40
Debug Dockerfile for Go applications
# build stage
FROM golang:1.8.3 AS build-env
ADD . /go/src/github.com/dlsniper/webinar
RUN go build -gcflags="-N -l" -o /webinar github.com/dlsniper/webinar
# final stage
FROM ubuntu:16.04
WORKDIR /
COPY --from=build-env /webinar /
ADD dlv /