Skip to content

Instantly share code, notes, and snippets.


Michael Endsley miend

View GitHub Profile
miend / service.yml
Created Jun 28, 2017
An example NodePort service.yml
View service.yml
kind: Service
apiVersion: v1
name: 'reports'
- protocol: 'TCP'
port: 443
targetPort: 443

Keybase proof

I hereby claim:

  • I am miend on github.
  • I am miend ( on keybase.
  • I have a public key ASB5vIV1yDEsMpnMwOONg4S8VAqErVRZt9Tiqdes7S-7hgo

To claim this, I am signing this object:

miend /
Last active Aug 29, 2015
Git rebase from origin shortcut
# Git rebase origin/["your checked out branch"]
function git_rebase_from_origin() {
git rebase origin/$(git rev-parse --symbolic-full-name --abbrev-ref HEAD)
alias 'gitrbo'='git_rebase_from_origin'
miend / cp-all.bash
Created Nov 13, 2012
Copy all files matching grep pattern to target directory
View cp-all.bash
for i in $(find /user/directory/ -name "grep-pattern"); do cp $i ~/destination/; done
miend / s3-delete-date.bash
Created Oct 17, 2012
Script to delete files from Amazon s3 that match given date
View s3-delete-date.bash
objects=$(s3cmd ls s3://bucket/directory/* |grep 2012-10-17 | cut -f13 -d' ')
for line in $objects ; do
s3cmd del $line
miend / escalatessh.bash
Created Sep 17, 2012
Simple scriptlet for parsing incoming SSH commands to either reject if they don't match the desired value or else escalate (via SUDO) if they do match
View escalatessh.bash
#! /bin/bash
# Exits if command not rsync.
# Escalates to root via sudo if rsync.
exit 1
/usr/bin/rsync\ --server\ --sender*)
miend / logosfunc.bash
Created Sep 17, 2012
Logos's handy functions.
View logosfunc.bash
function ipprint(){ LST=$@ ; ( [ -e "$LST" ] && cat $LST ; [ ! -e "$LST" ] && for i in $LST ; do echo $i ; done ) | while read host ; do echo -en "$host:\t$(dig +short $ )\n" ; done ; }
# Takes a string of arbitrary length of servers on your intranet and lists them colon-and-tab delimited next to their IP addresses
function ksmtop(){ (cd /sys/kernel/mm/ksm/ ; while true ; do date ; for i in `ls` ; do printf "%-20s %-20s\n" $i `cat $i` ; done ; sleep 2 ; clear ; done) ; }
# Does top-like output for a server's KSM metrics (RAM deduplication in KVM)
function inpath(){ for item in $@ ; do echo $PATH | awk -F':' '{ for (i=2 ; i<=NF ; i++) print $i ; }' | while read line ; do ls $line | grep $item ; done ; done ; }
miend /
Created Sep 16, 2012
Recursively search files for given expression
find ./ -name "*" -print | xargs grep "expression"
miend / rotation.bash
Created Sep 14, 2012
Better, simpler rotation script
View rotation.bash
# Find files in a path older than X days (represented by +X), execute removal.
# removes files older than 1 week
find /path/to/files/* -mtime +7 -exec rm {} \;
miend / clearnetwork_all.bash
Created Sep 14, 2012
Flush DNS cache, release and renew network IP address
View clearnetwork_all.bash
#if OSX
sudo dscacheutil -flushcache
sudo ipconfig set en0 BOOTP
sudo ipconfig set en0 DHCP
sudo ipconfig set en1 BOOTP
sudo ipconfig set en1 DHCP
You can’t perform that action at this time.