Skip to content

Instantly share code, notes, and snippets.

View AmreeshTyagi's full-sized avatar

Amreesh Tyagi AmreeshTyagi

  • India
View GitHub Profile
// api/controllers/AuthController.js
var passport = require('passport');
var AuthController = {
login: function (req,res)
{
res.view();
},
@AmreeshTyagi
AmreeshTyagi / tmux-cheatsheet.markdown
Created April 21, 2017 02:49 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
#!/bin/bash
OUTPUT="$(ls -1)"
echo "${OUTPUT}"
#Ref: https://stackoverflow.com/questions/4651437/how-to-set-a-variable-to-the-output-from-a-command-in-bash
#!/bin/bash
param=''
[[ -z "${param// }" ]]
#Ref: https://unix.stackexchange.com/questions/146942/how-can-i-test-if-a-variable-is-empty-or-contains-only-spaces
#!/bin/bash
IFS=';' read -ra ADDR <<< "$IN"
for i in "${ADDR[@]}"; do
# process "$i"
done
#Ref: https://stackoverflow.com/questions/918886/how-do-i-split-a-string-on-a-delimiter-in-bash
#!/bin/bash
verbose='false'
aflag=''
bflag=''
files=''
while getopts 'abf:v' flag; do
case "${flag}" in
a) aflag='true' ;;

These are generic npm scripts that you can copy & paste into your package.json file as-is and get access to convinience scripts to manage your Docker images all in one place.

Looking for npm scripts for AWS ECS? Go here!

Watch the video: Do More With Less JavaScript

Docker Containers for Static or Angular/React/Vue/etc SPA Websites

@AmreeshTyagi
AmreeshTyagi / get-token
Created June 1, 2018 03:47 — forked from snappytux/get-token
docker swarm get token
docker swarm join-token --rotate manager
#!/bin/sh
docker rm -f $(docker ps -qa)
docker rmi -f $(docker images -q)
docker volume rm $(docker volume ls -q)
for mount in $(mount | grep tmpfs | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do umount $mount; done
cleanupdirs="/etc/ceph /etc/cni /etc/kubernetes /opt/cni /opt/rke /run/secrets/kubernetes.io /run/calico /run/flannel /var/lib/calico /var/lib/etcd /var/lib/cni /var/lib/kubelet /var/lib/rancher/rke/log /var/log/containers /var/log/pods /var/run/calico"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
@AmreeshTyagi
AmreeshTyagi / mysql8.0-phpmyadmin-fix.sh
Last active January 24, 2019 14:51
mysql 8.0 caching_sha2_password fix for kubernetes
#!/bin/bash
# Please change values of <> placeholders as per your requirments.
# Step 1: Get mysql password from kubernetes pod, if installed from helm.
MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace <my-namespace> <mysql-secret-key> -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo)
# Step 2: Run mysql client in kubernetes
kubectl run -it --rm --image=mysql:8.0 --restart=Never mysql-client -- mysql -h <mysql-host> -u root -p$MYSQL_ROOT_PASSWORD
# Step 3: Run following query to chnage password method