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
# 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
# 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
# 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
# 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
# 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
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
--- | |
# | |
# 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
# get facts from a remote 'myhost.com' with ssh user root, password on prompt | |
ansible all -i 'myhost.com,' -m setup -u root -k | |
# Ansible playbook structure - create directories first, so you can run a single touch command | |
mkdir -p group_vars host_vars library filter_plugin roles/common/{tasks,handlers,templates,files,vars,defaults,meta} | |
touch ansible.cfg hosts.ini site.yml staging.ini production.ini roles/common/{tasks,handlers,templates,files,vars,defaults,meta}/main.yml |
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
# https://askubuntu.com/questions/53822/how-do-you-run-ubuntu-server-with-a-gui | |
sudo apt -y update | |
sudo apt install -y xorg | |
sudo apt install -y --no-install-recommends lightdm-gtk-greeter | |
sudo apt install -y --no-install-recommends lightdm | |
sudo apt install -y --no-install-recommends ubuntu-gnome-desktop |