start new:
tmux
start new with session name:
tmux new -s myname
# enable color support of ls and also add handy aliases | |
if [ "$TERM" != "dumb" ] | |
then | |
eval "$(dircolors -b)" | |
alias ls='ls --color=auto' | |
alias dir='ls --color=auto --format=vertical' | |
alias vdir='ls --color=auto --format=long' | |
fi | |
# some more ls aliases |
# System authorization information | |
auth --enableshadow --passalgo=sha512 | |
# Use CDROM installation media | |
cdrom | |
# Use text or graphical install | |
text | |
#graphical | |
# Run the Setup Agent on first boot | |
firstboot --enable |
#!/usr/bin/env bash | |
group_name="$1" | |
var_name="$2" | |
var_value="$3" | |
./create_dynamic_vars_db.py | |
sqlite3 dynamic_vars.db "INSERT OR REPLACE INTO group_vars ( group_name, var_name, var_value ) VALUES ( '${group_name}', '${var_name}', '${var_value}' );" |
#!/bin/sh | |
# | |
# About | |
# ----- | |
# This script sends simple system-metrics to a remote graphite server. | |
# | |
# | |
# Metrics | |
# ------- | |
# The metrics currently include the obvious things such as: |
New in Ansible 1.5, “Vault” is a feature of ansible that allows keeping sensitive data such as passwords or keys in encrypted files, rather than as plaintext in your playbooks or roles. These vault files can then be distributed or placed in source control. To enable this feature, a command line tool, ansible-vault is used to edit files, and a command line flag –ask-vault-pass or –vault-password-file is used. Alternately, you may specify the location of a password file or command Ansible to always prompt for the password in your ansible.cfg file. These options require no command line flag usage.
apk add php7-phar php7-sockets php7-pcntl | |
cd /usr/bin/ | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" | |
php composer-setup.php | |
php -r "unlink('composer-setup.php');" | |
ln -s composer.phar composer | |
cd /usr/share/webapps/icingaweb2-2.6.1/modules/vspheredb/ |
# now wait for ssh port | |
RETRY=20 | |
until [[ ${RETRY} -le 0 ]] | |
do | |
timeout 1 bash -c "cat < /dev/null > /dev/tcp/${VM_NAME}.${VM_DOMAIN}/22" 2> /dev/null | |
if [ $? -eq 0 ] | |
then | |
break | |
else | |
sleep 20s |
get_latest_release() { | |
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
grep '"tag_name":' | # Get tag line | |
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | |
} | |
# Usage | |
# $ get_latest_release "creationix/nvm" | |
# v0.31.4 |
#!/bin/bash | |
# https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash | |
vercomp() { | |
[[ $1 == $2 ]] && return 0 | |
v1=$(echo "$1" | sed -e 's|-|.|g') | |
v2=$(echo "$2" | sed -e 's|-|.|g') | |
local IFS=. |