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; |
| #!/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: |
| # | |
| # Create patch from SHA | |
| # http://stackoverflow.com/questions/6658313/generate-a-git-patch-for-a-specific-commit | |
| # --stdout option is available, too | |
| git format-patch -1 <sha> | |
| # | |
| # Apply Patch | |
| # https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/ |