Skip to content

Instantly share code, notes, and snippets.

Michael Endsley miend

  • Lumerit
  • San Antonio, TX
Block or report user

Report or block miend

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@miend
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
#!/bin/bash
objects=$(s3cmd ls s3://bucket/directory/* |grep 2012-10-17 | cut -f13 -d' ')
for line in $objects ; do
s3cmd del $line
done
@miend
miend / service.yml
Created Jun 28, 2017
An example NodePort service.yml
View service.yml
kind: Service
apiVersion: v1
metadata:
name: 'reports'
spec:
ports:
- protocol: 'TCP'
port: 443
targetPort: 443
selector:
View keybase.md

Keybase proof

I hereby claim:

  • I am miend on github.
  • I am miend (https://keybase.io/miend) on keybase.
  • I have a public key ASB5vIV1yDEsMpnMwOONg4S8VAqErVRZt9Tiqdes7S-7hgo

To claim this, I am signing this object:

@miend
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
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 $host.fqdn.com )\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
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.
case "$SSH_ORIGINAL_COMMAND" in
*\&*|*\|*|*\;*|*\>*|*\<*|*\!*)
exit 1
;;
/usr/bin/rsync\ --server\ --sender*)
sudo $SSH_ORIGINAL_COMMAND
@miend
miend / grepfiles.sh
Created Sep 16, 2012
Recursively search files for given expression
View grepfiles.sh
#!/bin/bash
find ./ -name "*" -print | xargs grep "expression"
@miend
miend / useful-terminal.sh
Last active Oct 10, 2015 — forked from joshkraemer/useful-terminal.sh
Useful Terminal Commands
View useful-terminal.sh
# 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/git@github.com:CollegePlus/git@github.com:collegeplus/g'
# 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
miend / clearnetwork_all.bash
Created Sep 14, 2012
Flush DNS cache, release and renew network IP address
View clearnetwork_all.bash
#!/bin/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
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.