Skip to content

Instantly share code, notes, and snippets.

View hostmaster's full-sized avatar
🏠
Working from home

Igor Khomyakov hostmaster

🏠
Working from home
  • Russia, Saint Petersburg
View GitHub Profile
@hostmaster
hostmaster / zsh-docker-completion.sh
Last active July 6, 2017 10:29
Get Zsh completion on Docker Mac with https://github.com/tarjoilija/zgen
for f in /Applications/Docker.app/Contents/Resources//etc/*.zsh-completion;
do
ln -sf "$f" "$HOME/.zgen/_${$(basename $f)%.zsh-completion}"
done
@hostmaster
hostmaster / s3-bucket-move
Created December 15, 2016 15:45 — forked from alanwill/s3-bucket-move
Move an S3 bucket to a different region
aws s3 sync s3://oldbucket s3://newbucket --source-region us-west-1 --region us-west-2
@hostmaster
hostmaster / iptables_rules.sh
Created December 5, 2016 09:40 — forked from virtualstaticvoid/iptables_rules.sh
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
#!/bin/bash
URL=http://S3_BUCKET.s3.amazonaws.com/FILENAME
filename=FILENAME
S3_MD5=$(curl -s -I -L $URL | awk '/ETag/ { gsub(/"|\r/,"",$2); print $2 }')
MD5="$(md5 -q $filename 2>/dev/null || :)"

Keybase proof

I hereby claim:

  • I am hostmaster on github.
  • I am hostmaster (https://keybase.io/hostmaster) on keybase.
  • I have a public key ASB5pWJf3Qws6exTwpuyHRSwczPADj4INmuJHFrJLm_b_Qo

To claim this, I am signing this object:

@hostmaster
hostmaster / policy-rc.d
Last active March 16, 2018 14:30
prevent services from starting automatically
case $2 in
stop|force-stop|status)
exit
;;
rotate)
exit
;;
*)
exit 101
;;
@hostmaster
hostmaster / dot_ssh_slash_config
Created November 18, 2015 12:17
'%C' is a the ultimate solution for SSH: 'ControlPath is too long' error
Host *
ControlMaster auto
ControlPath ~/.ssh/_%C
@hostmaster
hostmaster / gist:2b9f5154702aee81197b
Created September 8, 2015 16:14
aws resize root volume
aws ec2 stop-instances --instance-ids i-ID
aws ec2 detach-volume --volume-id vol-ID
aws ec2 create-snapshot --volume-id vol-ID
while : ; do aws ec2 describe-snapshots --snapshot-ids snap-ID; sleep 5; done
aws ec2 create-volume --snapshot-id snap-ID --availability-zone ${AZ} --size ${SIZE}
aws ec2 attach-volume --volume-id vol-NEWID --instance-id i-ID --device /dev/sda1
aws ec2 start-instances --instance-id i-ID
aws ec2 describe-instance-status --instance-id i-ID
@hostmaster
hostmaster / gist:2375a35cf19ab60b91a1
Last active December 18, 2015 09:59
Amazone IP adresses for EU west region $ curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | grep -B 1 -C1 -i 'eu-west' | grep -B2 -i 'ec2' | awk -F: '/ip_prefix/ { print $2 } ' | tr -d '",'
46.51.128.0/18
46.51.192.0/20
46.137.0.0/17
46.137.128.0/18
52.16.0.0/15
52.18.0.0/15
52.30.0.0/15
52.48.0.0/14
52.95.244.0/24
52.95.255.64/28
@hostmaster
hostmaster / 30-docker.conf
Created August 12, 2015 10:37
Write a separate log file for each docker container sending syslog messages.
template(name="DockerLog" type="string" string="/var/log/docker/container-%syslogtag:8:19%.log")
# syslog faciliyty is daemon
if ( $syslogfacility == 3 and $programname == "docker") then {
action(type="omfile" DynaFile="DockerLog")
stop
}