Skip to content

Instantly share code, notes, and snippets.

%s/.*"name":"\([-a-z0-9A-Z.]*\)".*/\1/g
Convert {"host":{"name":"host.domain.com","id":348,"hostgroup_id":null,"operatingsystem_id":5}}, to list of hostnames.
@inhumantsar
inhumantsar / gist:42707c9598bc993243b5
Created September 10, 2014 19:05
Extract substring from grep matches
grep openvpn::client dev.pp | sed -e "s/\s*openvpn::client\s*{ '\([a-zA-Z]*\)':/\"\1\",/g"
takes
openvpn::client { 'serged':
openvpn::client { 'danielc':
openvpn::client { 'nigelg':
and converts it to
"serged",
"danielc",
"nigelg",
@inhumantsar
inhumantsar / multiargs.md
Created October 22, 2014 19:54
Bash Snippets
@inhumantsar
inhumantsar / update-route53.sh
Last active July 22, 2021 22:16 — forked from phybros/update-route53.sh
Update Amazon Route 53 from Bash
#!/bin/bash
ZONEID='' # Hosted Zone ID e.g. BJBK35SKMM9OE
RECORDSET='' # The CNAME you want to update e.g. hello.example.com
TTL=300 # The Time-To-Live of this recordset
TYPE='A' # Change to AAAA if using an IPv6 address
COMMENT="Auto updating @ `date`"
IP=`curl -ss https://icanhazip.com/` # Get the external IP address
LOGPATH='/var/log'
@inhumantsar
inhumantsar / docker-cp
Created October 31, 2014 05:57
Copy a file from the host to a running Docker container
#!/bin/bash
cp $1 /var/lib/docker/aufs/mnt/`docker inspect -f '{{.Id}}' $2`/
#!/bin/bash
if ! which wget > /dev/null; then
yum install -y wget
fi
export DOCKER_VERSION=1.3.0
pushd /tmp
if [ ! -f /usr/bin/docker ]; then
KEYBINDINGS
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings
are:
F2 - Create a new window
F3 - Move to previous window
F4 - Move to next window
@inhumantsar
inhumantsar / linuxcheatsheet.md
Created January 22, 2015 18:44
Linux Cheat Sheet

To free pagecache, dentries and inodes:

  • free && sync && echo 3 > /proc/sys/vm/drop_caches && free
Stop/restart watching for changes in a file:
git update-index --assume-unchanged <file>
git update-index --no-assume-unchanged <file>
13:41 <alisdair> 6000 keystrokes per hour
13:41 <alisdair> that seems high
13:43 <cheeseprocedure> 100 words per minute is 6000 words per hour, yes? 6000 keystrokes should be pretty easy
13:43 <cheeseprocedure> it does seem like a bizarre metric though
13:43 <cheeseprocedure> oh, data entry
13:44 <cheeseprocedure> so probably more like punching digits into a numpad mindlessly?
14:42 <Lefty> I could probaby type 6000 keystrokes per hour using only my buttcheeks
14:42 <Lefty> in fact I'm going to apply just to attempt that
14:42 <cheeseprocedure> i look forward to your after-action report
14:42 <cheeseprocedure> also, i hope they have spare keyboards