Skip to content

Instantly share code, notes, and snippets.

@nayyaung
nayyaung / database.rules.json
Created Jun 12, 2020 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
View database.rules.json
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@nayyaung
nayyaung / wrap_middleware.js
Created Apr 16, 2020
wrapping expressjs middleware
View wrap_middleware.js
// SOURCE: https://stackoverflow.com/questions/47572752/calling-a-middleware-from-within-a-middleware-in-nodejs-expressjs
const wrappingMiddleware = (req, res, next) => {
try {
if (process.env.SOME_VAR === 'true') {
let externalMiddleware = logger({
custom:true
});
return externalMiddleware(req,res,next);
} else {
@nayyaung
nayyaung / jq-variable-slurp.sh
Last active Dec 27, 2019
Passing bash variable to jq for usage in slurp expression
View jq-variable-slurp.sh
jq --arg variable "$variable" -s '.[0] * .... "'$variable'" ... ' other-input-to-slurp
@nayyaung
nayyaung / delete-directory.ps1
Created Sep 3, 2018
Delete children folders recursively on Windows using powershell 5.1
View delete-directory.ps1
get-childitem logs -path .\ -directory -recurse | remove-item -confirm:$false -recurse -force
@nayyaung
nayyaung / minikube script
Last active Oct 5, 2017
Starting minikube on Windows with Proxy
View minikube script
# first, download cntlm and setup proxy on local
minikube start --docker-env http_proxy=http://10.0.2.2:3128 --docker-env https_proxy=http://10.0.2.2:3128 --docker-env no_proxy=no_proxy=localhost,127.0.0.1,$YOUR_DOCKER_REPOSITORY$,10.160.170.30,10.0.0.0/24,192.168.99.0/24
# 10.0.2.2 is the gateway IP of minikube virtual box. "route -n" can be used to find out gateway.