start new:
tmux
start new with session name:
tmux new -s myname
############################################################################ | |
# _ | |
# | |_ _ __ ___ _ ___ __ | |
# | __| '_ ` _ \| | | \ \/ / | |
# | |_| | | | | | |_| |> < | |
# \__|_| |_| |_|\__,_/_/\_\ | |
# | |
# Cheatsheets: | |
# https://devhints.io/tmux | |
# `property not found` issue: |
function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s } | |
function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s } | |
function trim(s) { return rtrim(ltrim(s)); } | |
BEGIN { | |
# whatever | |
} | |
{ | |
# whatever | |
} | |
END { |
sudo yum update | |
sudo yum install python27 | |
curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | sudo /usr/bin/python27 | |
sudo easy_install pip | |
echo "alias python='python27'" >> ~/.bashrc | |
source ~/.bashrc |
When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.
This is enabled by adding the
ForwardAgent yes
option to any of your Host
entries in ~/.ssh/config
(or alternatively with the -A
option). Don't set this option in a wildcard Host *
section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.
wget http://stedolan.github.io/jq/download/linux64/jq | |
aws ec2 describe-instances --filters "Name=tag:Name,Values=$NAME" \ | |
"Name=instance-state-name,Values=running" \ | |
| jq -r \ | |
".Reservations[] | .Instances[] | .InstanceId" \ | |
aws ec2 describe-volumes --filters \ | |
"Name=status,Values=available" \ | |
| jq -r ".Volumes[] | .VolumeId" \ |
DROP FUNCTION IF EXISTS MurmurHashV3; | |
DELIMITER // | |
CREATE FUNCTION `MurmurHashV3`(`keyx` varchar(65535), `seed` int unsigned) | |
RETURNS int unsigned | |
BEGIN | |
DECLARE remainder,bytes,c1,c2,i, m1,m2 INT unsigned; | |
DECLARE h1,k1,h1b BIGINT unsigned; | |
SET remainder = LENGTH(keyx) & 3; | |
SET bytes = LENGTH(keyx) - remainder; | |
SET h1 = seed; |
I'm just getting up to speed on AWS, and so I'm learning my way around the CLI. It's nice and easy to do lots of things from the CLI, like querying, creating and destroying instances and images. There are lots of fiddly bits involved in parsing output so it can be used by a script or something, though, so here are some notes.
Obviously you need the AWS CLI. It's an easy install using pip. Go here to find documentation and other install methods.
#!/usr/bin/python | |
DOCUMENTATION = ''' | |
--- | |
module: git_facts | |
version_added: "devel" | |
short_description: retrieve facts about a git repository | |
description: | |
- retrieve facts about a git repository. This module has a dependency on GitPython. | |
options: |