{{ message }}

Instantly share code, notes, and snippets.

AndreKR

Last active May 20, 2018
Build smaller executables with Go
View go_release_build.txt
This file contains 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 build -gcflags=all=-trimpath=c:\path\to\trim -asmflags=all=-trimpath=c:\path\to\trim -ldflags=all="-s -w" upx ...
Created Mar 15, 2017
View go_webdriver_comparison.go
This file contains 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 ( agwd "github.com/sclevine/agouti" tbwd "github.com/tebeka/selenium" "log" sgwd "sourcegraph.com/sourcegraph/go-selenium" ) // Helper for sourcegraph/go-selenium
Created Dec 13, 2018
Get all resources in a Kubernetes cluster
View get_all_kubernetes_resources.md

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

Last active Mar 29, 2019
TortoiseGit + DiffMerge
View tgit_dmerge.txt
This file contains 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
 "C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe" -m -t1=%yname -t2=%bname -t3=%tname -result=%merged %mine %base %theirs
Last active Oct 7, 2019
Initializing logrus
View logrus.go
This file contains 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
 // The state of Go logging libraries is disheartening... import ( "github.com/mattn/go-colorable" // not ansicolor because github.com/mgutz/ansi recommends colorable log "github.com/sirupsen/logrus" "github.com/x-cray/logrus-prefixed-formatter" "golang.org/x/crypto/ssh/terminal" "os" )
Created Jul 12, 2020
Read a BLE characteristic on Android
View BleStateMachine.java
This file contains 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 com.example.android.app; import android.app.Activity; 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;
Last active Nov 19, 2020
View mysql_to_postgresql.txt
This file contains 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
 To help you with the process of converting a MySQL app to PostgreSQL, I collected a list of differences between MySQL and PostgreSQL (PG). Important changes: * Strings are quoted with '...' or with $token$...$token$. Single-quotes are escaped with single-quotes. * Identifiers are folded to lowercase, unless they are quoted with "..." which makes them case-sensitive * The max identifier length is 63 * There are some system columns that cannot be used as an identifier (probably not a problem) * Expressions are evaluated in arbitrary order, so WHERE x > 0 AND y/x > 1.5 can lead to a division by zero and has to be replaced with WHERE CASE WHEN y > 0 THEN y/x > 1.5 ELSE FALSE END * SELECT CASE WHEN x > 0 THEN x ELSE 1/0 END would still lead to a division by zero because the constant 1/0 is evaluated even before the query starts
Created Jul 30, 2021
A simpler Android CountDownTimer
View SimpleCountDownTimer.java
This file contains 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 foo; import android.os.CountDownTimer; public class SimpleCountDownTimer { boolean repeat; Runnable action; CountDownTimer c;
Created Aug 24, 2017
Vue.js v-model vs. v-bind.sync
View model_vs_sync.md

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>