Skip to content

Instantly share code, notes, and snippets.

Michael Endsley miend

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 / 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 / gitrbo.sh
Last active Aug 29, 2015
Git rebase from origin shortcut
View gitrbo.sh
# 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
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 / 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 / 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 / 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 / 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 / rotation.bash
Created Sep 14, 2012
Better, simpler rotation script
View rotation.bash
#!/bin/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
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
You can’t perform that action at this time.