Skip to content

Instantly share code, notes, and snippets.

@anhkind
anhkind / unix.md
Last active May 9, 2024 08:36
Unix misc
@anhkind
anhkind / wirerest_grafana_config.yml
Last active April 5, 2024 11:18
Wirerest dashboard on Grafana
# For Grafana dashboard: https://grafana.com/grafana/dashboards/19458-wireguard-wirerest-jvm/
# put these under `metrics.configs.scrape_configs`
- job_name: 'wirerest'
metrics_path: '/actuator/prometheus'
authorization:
credentials: YOUR_WIREREST_TOKEN
static_configs:
targets: ['YOUR_WIREREST_IP:8081']
@anhkind
anhkind / .profile
Last active January 22, 2024 07:18
Select git executable in WSL
# from: https://github.com/microsoft/WSL/issues/4401#issuecomment-670080585
# checks to see if we are in a windows or linux dir
function isWinDir {
case $PWD/ in
/mnt/*) return $(true);;
*) return $(false);;
esac
}
# wrap the git command to either run windows git or linux
@anhkind
anhkind / rerender.directive.ts
Created August 5, 2021 08:56
Angular directive to re-render a template if it detects any changes of the input
/**
* Example:
*
* <ng-container *rerender='changingInput'>
* this content will be re-rendered everytime `changingInput` changes
* </ng-container>
*/
import { Directive,
Input,
@anhkind
anhkind / yardoc_cheatsheet.md
Created April 9, 2020 07:17 — forked from phansch/yardoc_cheatsheet.md
Improved YARD cheatsheet
@anhkind
anhkind / virtualbox.sh
Last active December 22, 2018 05:25
Settings of Virtualbox
# HOST
# make symlink work on shared folder (from: https://github.com/npm/npm/issues/992#issuecomment-174154202)
VM_NAME="Ubuntu"
SHARE_NAME="sf_dev"
VBoxManage setextradata "$VM_NAME" VBoxInternal2/SharedFoldersEnableSymlinksCreate/$SHARE_NAME 1
# check again
VBoxManage getextradata "$VM_NAME" enumerate
@anhkind
anhkind / upgrade.sh
Last active September 20, 2018 15:46
Upgrade Node and Yarn
brew upgrade node
brew upgrade yarn
yarn install --ignore-engines
@anhkind
anhkind / enable-camera2api.sh
Created August 22, 2018 08:10
Enable Camera2API
fastboot boot ~/Downloads/twrp-3.2.3-0-nitrogen.img
adb shell
setprop persist.camera.HAL3.enabled 1
setprop persist.camera.eis.enable 1
exit
@anhkind
anhkind / get-set.ts
Last active July 25, 2018 12:20
Typescript - get/set property
class User {
private _birthDate: string;
// can behave like a LAZY property
get birthDate(): string {
if (this._birthDate) {
return this._birthDate;
}
return this._birthDate = '1981-11-11';
DESCRIPTION TEXT COLOR
classic site classic green
PWA PWA red
API API blue
mobile mobile orange
unknown unknown gray
technical debt debt purple
chore chore purple
bug bug black