Last active
January 25, 2019 20:50
-
-
Save markmorlino/dade7ceabb1ce768660378c8abbfb8a0 to your computer and use it in GitHub Desktop.
one-ish liners
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Starting a list of random things that I have found useful but can't always seem to remember and got tired of re-creating them over and over again. | |
# quickly use ping to see what is responding on a subnet (for when you just don't have the right tools on hand) | |
for I in 192.168.1.{1..254} ; do ping -c 1 $I >/dev/null 2>&1 && echo "$I answers pings" & done 2>&1 | grep answers | grep -v Exit | |
# quickly clean up a bunch of docker images (I think docker might have finally added somethign to do this) | |
docker rmi -f $(docker image ls | grep -v REPOSITORY | awk '{print $3}') | |
# delete an old cached host key, if it complains about line 123 | |
sed -i 123d ~/.ssh/known_hosts | |
# delete a bunch by IP | |
for H in 50 51 52 ; do sed -i -e "/10.10.10.${H}/d" ~/.ssh/known_hosts ; done | |
# AWS Route53 | |
aws route53 list-resource-record-sets --hosted-zone-id <id> | \ | |
jq -r '.ResourceRecordSets[] | select(.Name |contains("fubar.com")) | select(.Type=="A" or .Type=="CNAME") | "\(.Name) \(.ResourceRecords[].Value)"' | |
# jenkins list installed plugins | |
curl -sk -u username:password 'https://jenkins.foo.com:8443/pluginManager/api/json?depth=1&?xpath=/*/*shortName|/*/*/version' | python -mjson.tool | jq -r '.plugins[] | "\( .shortName).\(.version)"' | |
# jenkins export job | |
curl -sk -u username:password https://jenkins.foo.com/job/myjob/config.xml -o myjob.xml | |
# jenkins import job | |
curl -sk -u username:password -X POST -H "Content-Type:text/xml" 'https://jenkins.foo.com/createItem?name-myjob2' --data-binary @myjob.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment