Skip to content

Instantly share code, notes, and snippets.


Michael Endsley miend

  • Lumerit
  • San Antonio, TX
View GitHub Profile
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 / 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 / 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 / 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 / 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 /
Created Sep 16, 2012
Recursively search files for given expression
find ./ -name "*" -print | xargs grep "expression"
miend /
Last active Oct 10, 2015 — forked from joshkraemer/
Useful Terminal Commands
# Start an application in the background (leaving terminal free for other use once it starts)
application-name [whatever options] &
# No really, just put & on the end of it. Trust me.
# Recursively find all files named config and replace a string using sed. The -i flag requires a blank suffix '' to work on Mac.
find . -name config -type f -print | xargs sed -i '' 's/'
# Recursively find all files with a certain file extension and replace a string using perl.
find . -name "*.fileext" -print | xargs perl -i -p -e 's/STRINGTOFIND/STRINGTOREPLACE/g'
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
miend / mime.types
Created Sep 14, 2012 — forked from joshkraemer/mime.types
Nginx Configuration Optimized for Unicorn Rails Apps
View mime.types
# /etc/nginx/mime.types
# Global Nginx mime.types file
types {
text/html html htm shtml;
text/css css;
text/xml xml rss;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
You can’t perform that action at this time.