Skip to content

Instantly share code, notes, and snippets.

@Remz-Jay
Last active December 17, 2015 05:28
Show Gist options
  • Save Remz-Jay/5557553 to your computer and use it in GitHub Desktop.
Save Remz-Jay/5557553 to your computer and use it in GitHub Desktop.
Shell wizardyRandom snippets of one-line awesomeness.
for d in $(find . -type d -name 'aaf-*'); do echo mv $d `echo $d|sed 's/aaf-\(.*\)$/\1-aaf/g'`; done
# mv ./aaf-top.gear.s15e06.1080p.bluray.x264 ./top.gear.s15e06.1080p.bluray.x264-aaf
# mv ./aaf-top.gear.s14e02.720p.bluray.x264 ./top.gear.s14e02.720p.bluray.x264-aaf
# mv ./aaf-top.gear.s14e03.720p.repack.bluray.x264 ./top.gear.s14e03.720p.repack.bluray.x264-aaf
# mv ./aaf-top.gear.s15e04.1080p.bluray.x264 ./top.gear.s15e04.1080p.bluray.x264-aaf
# mv ./aaf-top.gear.s14e05.720p.bluray.x264 ./top.gear.s14e05.720p.bluray.x264-aaf
# mv ./aaf-top.gear.s14e06.bluray720 ./top.gear.s14e06.bluray720-aaf
# mv ./aaf-top.gear.s15e03.1080p.bluray.x264 ./top.gear.s15e03.1080p.bluray.x264-aaf
# mv ./aaf-top.gear.s15e05.1080p.bluray.x264 ./top.gear.s15e05.1080p.bluray.x264-aaf
# mv ./aaf-top.gear.s15e02.1080p.bluray.x264 ./top.gear.s15e02.1080p.bluray.x264-aaf
# mv ./aaf-top.gear.s14e07.720p.bluray.x264 ./top.gear.s14e07.720p.bluray.x264-aaf
# mv ./aaf-top.gear.s14e01.bluray720 ./top.gear.s14e01.bluray720-aaf
# mv ./aaf-top.gear.s14e04.720p.bluray.x264 ./top.gear.s14e04.720p.bluray.x264-aaf
for module in `find /etc/puppet/environments/common/ -iname Modulefile -exec cat {} \; | grep "name " | awk '{print $2;}' | sed "s/'//g"`; do puppet module upgrade --modulepath /etc/puppet/environments/common --environment common $module; done
for f in `ls | sed -e 's/.yaml//g'`; do ssh -o ConnectTimeout=5 root@$f "sed -i '/84.53.103.71/c\149.210.174.225 puppet.maxserv.com puppet' /etc/hosts"; done
for host in `cat .ssh/known_hosts | cut -d' ' -f 1 | cut -d, -f 1`; do echo $host; read REPLY; if [[ $REPLY =~ ^[Yy]$ ]]; then; ssh root@$host "sed -i '/84.53.103.71/c\149.210.174.225 puppet.maxserv.com puppet' /etc/hosts"; fi; done
find ./ -iname "*.pp" -exec sed -i '' 's/ / /g' {} \+
find . -iname "*.pp" -exec sed -i '' 's/[[:space:]]*$//' {} \+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment