This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package cli | |
| import ( | |
| "log" | |
| "os" | |
| "runtime" | |
| "runtime/pprof" | |
| ) | |
| func maybeProfile() func() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://github.com/docker-library/golang/blob/f300e60ca19c3b98cfcf01ca112af2ac10104320/1.17-rc/alpine3.14/Dockerfile#L30 | |
| apkArch="$(apk --print-arch)"; \ | |
| case "$apkArch" in \ | |
| 'x86_64') \ | |
| export GOARCH='amd64' GOOS='linux'; \ | |
| ;; \ | |
| 'armhf') \ | |
| export GOARCH='arm' GOARM='6' GOOS='linux'; \ | |
| ;; \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "runtime" | |
| ) | |
| func a(f func()) { | |
| defer func() { | |
| if rv := recover(); rv != nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM debian:9.5 | |
| # Update, and install basic packages | |
| RUN apt-get update | |
| RUN apt-get install -y build-essential curl git python | |
| # install depot_tools http://www.chromium.org/developers/how-tos/install-depot-tools | |
| RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
| ENV PATH /depot_tools:$PATH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def csv: split(","); | |
| def csv_kv: [csv[] | split("=") | {(.[0]): .[1]}] | add; | |
| def obj_to_csv_kv: [to_entries[] | [.key, .value] | join("=")] | join(","); | |
| # TODO: errors? | |
| def csv_range_map: | |
| # "0-2=a,1=b" -> ["a", "b", "a"] | |
| [ csv[] | |
| | split("=") | |
| | .[1] as $c | |
| | .[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| go run always exits with error code 1 https://github.com/golang/go/issues/13440 | |
| probably the reason it print the error code | |
| -coverpk=./... will load all packages, even non-imported ones, causing init() to run | |
| Default behaviour of signals on linux: | |
| https://github.com/golang/go/blob/master/src/runtime/sigtab_linux_generic.go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| docker run -ti --rm -v "$PWD:$PWD" -w "$PWD" -v /var/run/docker.sock:/var/run/docker.sock ubuntu | |
| apt-get install cmake pkg-config libicu-dev docker.io ruby ruby-dev libz-dev build-essential libssl-dev | |
| gem install bundler | |
| script/bootstrap | |
| script/add-grammar https://github.com/wader/linguist-language-jq | |
| script/update-ids | |
| bundle exec rake samples | |
| bundle exec rake test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # work fine for 9.4 to 13 | |
| pg_dump -c -U postgres postgre > db.sql | |
| psql -U postgres < db.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "debug": { | |
| "prefix": "dd", | |
| "body": "debug |", | |
| "description": "Snippet for debug" | |
| }, | |
| "debug variable": { | |
| "prefix": "dv", | |
| "body": "(. as $$c | [\"$${1:var}\", $${1:var}] | debug | $$c) |", | |
| "description": "Snippet for debug variable" |