This file contains hidden or 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
--- | |
# | |
# Filename : getfacts.yml | |
# Date : 15 Dec 2017 | |
# Author : Balaji Venkataraman ([email protected]) | |
# Description : get facts about hosts | |
# | |
# Usage: | |
# run this playbook against specific host(s) as follows: |
This file contains hidden or 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
use the technique described in http://docs.ansible.com/ansible/latest/config.html#default-vault-password-file | |
create a file: vault-pass.sh | |
cat > vault-pass.sh << EOF | |
#! /bin/bash | |
echo $ANSIBLE_VAULT_PASSWORD | |
EOF | |
chmod +x vault-pass.sh |
This file contains hidden or 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
# from: https://recipes.readthedocs.io/en/latest/pyserv.html | |
screen -dmS pyserv python -m SimpleHTTPServer 80 | |
# simple screen cheat sheet | |
# | |
# To list detached screen sessions | |
# screen -ls | |
# |
This file contains hidden or 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
# ignore swap files | |
*.sw? | |
.*.un~ | |
.*.sw~ | |
# global git ignore, for all repos | |
# git config --global core.excludesfile ~/.gitignore_global | |
# see also: https://github.com/github/gitignore |
This file contains hidden or 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
# oneliners-generate-index-html.sh | |
# this takes care of sub directories as well, adds a table with row numbers, easy for reference | |
# wrote this script for generating pages in gitlab :) | |
find . -type f | sort | awk 'BEGIN {print "<html><body><table align=center border=1>"} {printf "<tr><td>%d<td><a href=\"%s\">%s</a>\n", FNR, $0, $0 } END {print "</table></body></html>"}' > index.html |
This file contains hidden or 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
# run a python 2.7 in a docker container, debian linux, apt works | |
docker run --name py27 -d -t python:2.7 | |
# exec bash in the docker container | |
docker exec -i -t py27 /bin/bash | |
# run a container with mounting directory, mount volume should be absolute path | |
docker run --name py27 -d -t -v ~/all/xb-all/utils:/utils python:2.7 | |
# stop and remove a running container |
This file contains hidden or 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
# git ignore certificates | |
# git -c http.sslVerify <git command> | |
git -c http.sslVerify=false pull | |
# to disable for the entire repo | |
git config http.sslVerify false | |
This file contains hidden or 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
# see: https://stackoverflow.com/questions/5613345/how-to-shrink-the-git-folder | |
# good and safe command - from http://gcc.gnu.org/ml/gcc/2007-12/msg00165.html | |
git repack -a -d --depth=250 --window=250 | |
# default options should be enough for most cases, see: https://git-scm.com/docs/git-repack | |
git repack -a -d | |
# agressive way |
This file contains hidden or 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
# in a single line | |
echo "wget http://bit.ly/xb-do-unix -q -O test02.txt" | at now + 1 minutes | |
# using here document | |
at 6:26 PM << EOF | |
wget http://bit.ly/xb-do-unix -q -O test02.txt | |
EOF | |
# if there is no EOF given, use CTRL+D to terminate the commands |
This file contains hidden or 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
# from https://superuser.com/questions/472476/is-there-an-automatically-scrolling-time-delayed-unix-pager-command | |
function scroll | |
{ | |
while read -r ; do echo "$REPLY" ; sleep ${1:-0.5} ; done | |
} | |
# assuming you have source code src directory | |
find src -type f -name "*c" -exec cat {} \; | scroll 0.2 | |
# use the following vimpager, asciinema, asciicast2gif |