Skip to content

Instantly share code, notes, and snippets.

View mwinters0's full-sized avatar

Michael Winters mwinters0

View GitHub Profile
@mwinters0
mwinters0 / ftpmon.php
Created August 21, 2012 22:17
QnD php cli ftp spy
<?php
//Super Q&D. Monitors a single FTP directory for new files.
//Modify the vars below and run as 'php ftpmon.php'.
//Notification is via growlnotify, which requires purchase of growl.
$host = "ftp.host.com";
$user = "ftpuser";
$pass = "secret";
@mwinters0
mwinters0 / vshef.sh
Created October 5, 2012 18:37
Run shef in vagrant
shef -s -c /tmp/vagrant-chef-1/solo.rb -j /tmp/vagrant-chef-1/dna.json
#!/bin/bash
# from http://stackoverflow.com/questions/3971822/yaml-syntax-validator
ruby -e "require 'yaml';puts YAML.load_file('$1')"
@mwinters0
mwinters0 / ec2_get_tag.sh
Created February 14, 2017 19:20
Bash to get Name tag on EC2 instances
# Gets any tag value, default 'Name'. Assumes that `aws` CLI is
# installed, and the IAM role has Describe-Tags permissions.
TAG=Name
INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
REGION=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}')
TAG_VALUE=$(aws ec2 describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" "Name=key,Values=$TAG" --region=$REGION --output=text | cut -f5)
@mwinters0
mwinters0 / check_nodes_for_plugin.sh
Created May 25, 2017 21:29
Find which nodes in your elasticsearch cluster are missing the cloud-aws plugin
#!/bin/bash
#Assumes that you already have jq installed
curl 'localhost:9200/_nodes' | jq '.nodes[] | if (.plugins | map(.name == "cloud-aws") | any) == false then {name: .name, ip: .ip} else empty end'

Keybase proof

I hereby claim:

  • I am MikeSchuette on github.
  • I am mikeschuette (https://keybase.io/mikeschuette) on keybase.
  • I have a public key whose fingerprint is 241A C25E 2FD6 A447 2A07 2B2B 0948 DF33 EAD1 37EC

To claim this, I am signing this object:

#!/bin/bash
ifconfig | grep -E 'inet |inet addr' | awk '{print $2}' | cut -d ':' -f 2 | grep -E '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)'
@mwinters0
mwinters0 / create_kubernetes_cluster_with_kops_and_terraform.md
Last active June 12, 2018 19:48
Create a Kubernetes cluster at AWS with kops and terraform

Create a Kubernetes cluster at AWS with kops and terraform

This is how I do it. Considerations going into this approach are:

  • It puts all of your resources under terraform control, making it easy to reuse terraform code from other projects and/or use terraform for further integrations.
  • It permits a fair amount of flexibility in workstation configuration (no need to hardcode your workstation to match mine).
  • It provides a good setup for locally switching between multiple projects which might not all be running the same versions.

The examples here will assume that you are going to create a dev cluster for a fictional product named "Bigmoney". It is suggested to not use your product name in your cluster names, since product names are at the whim of marketing and other business tides. Instead, we will use a project codename of "ampersand" to signify "my team's clusters".

Workstation setup

@mwinters0
mwinters0 / pr_clean.sh
Created May 1, 2017 20:19
Pull master and clean dead local branches after a PR
#!/bin/bash
echo "Switching to master and pulling ..."
git checkout master
if [[ ! $? -eq 0 ]]; then
echo
echo Unable to checkout master, aborting.
exit
fi
git pull
@mwinters0
mwinters0 / effective_meetings.md
Created January 22, 2019 22:03
Holding Effective Meetings

Holding Effective Meetings

(Courtesy of bradrox.)

One of the things that interested me most about joining this team was the opportunity to work with a bunch of very competent people. Smart people, working hard can accomplish a tremendous amount more than any process and training can do. Thank you for this opportunity!

Smart people get bored easily. Meetings provide a perfect breeding ground for boredom. Once you’ve said what you need to say, it can be difficult to listen to everyone else who needs to say what they came to say. Smart, bored people have very clever ways of creating distractions that reduce the effectiveness of meetings. However, “effective listening” is one of the most important techniques to master if you want to shorten meetings…and thereby reduce boredom. Here are a few reminders that should improve the effectiveness of your next meeting. You can find many other resources available on the web.