Skip to content

Instantly share code, notes, and snippets.

AndreKR / Dockerfile
Created August 5, 2022 02:51
Dockerfile COPY cheat sheet
View Dockerfile
# Copies the file into the directory (both are equivalent):
COPY some_file /some_directory/
COPY some_file /some_directory/some_file
# Copies both files into the directory:
COPY some_file another_file /some_directory/
# Copies the contents of the directory (but not the directory itself) into the other directory:
COPY some_directory /other_directory/
AndreKR /
Created July 30, 2021 02:16
A simpler Android CountDownTimer
package foo;
import android.os.CountDownTimer;
public class SimpleCountDownTimer {
boolean repeat;
Runnable action;
CountDownTimer c;
AndreKR /
Created July 12, 2020 18:55
Read a BLE characteristic on Android
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothProfile;
AndreKR / logrus.go
Last active October 7, 2019 17:31
Initializing logrus
View logrus.go
// The state of Go logging libraries is disheartening...
import (
"" // not ansicolor because recommends colorable
log ""
AndreKR / tgit_dmerge.txt
Last active March 29, 2019 08:17
TortoiseGit + DiffMerge
View tgit_dmerge.txt
"C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe" -m -t1=%yname -t2=%bname -t3=%tname -result=%merged %mine %base %theirs
AndreKR /
Created December 13, 2018 22:38
Get all resources in a Kubernetes cluster

kubectl api-resources --verbs=list -o name | xargs -n 1 -t kubectl get --ignore-not-found --all-namespaces

AndreKR /
Created August 24, 2017 06:11
Vue.js v-model vs. v-bind.sync

Vue.js: v-model vs. v-bind:<propname>.sync

These examples use the expression foo as the data source in the parent.

Prop name Event name
v-model="foo" value by default input by default
v-bind:<propname>.sync="foo" arbitrary update:<propname>


AndreKR / latest_gitlab_artifacts.txt
Last active September 13, 2017 19:06
Download the latest artifacts from GitLab
View latest_gitlab_artifacts.txt
# ZIP:
wget --header="PRIVATE-TOKEN: $GITLAB_TOKEN" "https://<gitlab>/<group>/<project>/builds/artifacts/master/download?job=<jobname>"
wget --header="PRIVATE-TOKEN: $GITLAB_TOKEN" "https://<gitlab>/<group>/<project>/-/jobs/artifacts/master/download?job=<jobname>"
# Single file:
wget -O /path/to/file --header="PRIVATE-TOKEN: $GITLAB_TOKEN" "https://<gitlab>/<group>/<project>/builds/artifacts/master/raw/<filename>?job=<jobname>"
AndreKR / go_release_build.txt
Last active May 20, 2018 17:58
Build smaller executables with Go
View go_release_build.txt
go build -gcflags=all=-trimpath=c:\path\to\trim -asmflags=all=-trimpath=c:\path\to\trim -ldflags=all="-s -w"
upx ...
View exedir.go
var exeDir = getExeDir()
func getExeDir() string {
if os.Getenv("EXEDIR") != "" {
return os.Getenv("EXEDIR")
} else {
return filepath.Dir(os.Args[0])