Skip to content

Instantly share code, notes, and snippets.


Dave Josephsen djosephsen

  • Usually BZN, sometimes DFW
View GitHub Profile
View gist:1d526a850debb604600b045b6880d7fb
#!/usr/bin/env python
import sys
import requests
from termcolor import colored
# get an api key from
APIKEY = '<your api key here>'
URL = ''
word = sys.argv[1]

Keybase proof

I hereby claim:

  • I am djosephsen on github.
  • I am djosephsen ( on keybase.
  • I have a public key ASCwtAF8cbR98l0U5uP1v4G2XYN7Y-e_okok55Za1f-98wo

To claim this, I am signing this object:

djosephsen / s3-vdelete
Created Dec 7, 2018
Delete all previous versions of an object on S3 except the most recent
View s3-vdelete
#!/usr/bin/env bash
function error {
echo "ERROR:: ${@}"
exit 2
djosephsen / developer_anthropolgy_101
Created Oct 2, 2018
I'm a newly embedded SRE; how do I get to know my dev team and their product?
View developer_anthropolgy_101
Open Curiousity
/ALWAYS ask stupid questions/
Acknowledge design wins, and call out things that don't look right
* If your service has a front-end DNS name, reverse engineer it. What system actually responds to the initial request? An edge cache? A Load Balancer? An Nginx host?
* Make a map of the lifecycle of a request to your team's service that begins at dns, and ends at the service's listening port
* what does a request into your service look like? Is it an API endpoint? can you curl it? If so, craft a CURL request that you can use to test whether or not your service is "up"
def __get_gh_repos(teamname):
looks up team ID from the organization then returns a list of repos
for which that team are collaborators
params = ''
base_url = ''
headers = { 'Accept' :'application/vnd.github.v3+json', "Content-type" : "application/json", \
'User-Agent' : '', 'Authorization': 'token ' + app.config['GH_API_TOKEN'] }
req = requests.get(base_url + 'orgs/librato/teams', auth=(app.config['GH_API_TOKEN'], 'x-oauth-basic')).text
View Simplistic Librato Agent Cost Calculator
View docker_issues
[ { "url": "", "labels_url": "{/name}", "comments_url": "", "events_url": "", "html_url": "", "id": 117446711, "number": 18048, "title": "docker daemon crash when starting container after: RequestAddress(LocalDefault/, <nil>, map[])", "user": { "login": "bschiffthaler", "id": 8308279, "avatar_url": "", "gravatar_id": "", "url": "", "html_url": "", "followers_url": "", "following_url": "{/other_user}", "gists_url": "{/gist_id}", "starred_url":
djosephsen / run-parts-wrapper
Last active Aug 29, 2015
A wrapper for /bin/run-parts that works with shellbrato to capture cron jobs as annotation events in librato
View run-parts-wrapper
RP='/bin/run-parts-orig' #where's the original run-parts?
SHELLBRATO='/opt/shellbrato/' #where's shellbrato?
LBCREDS='/home/dave/librato_creds' #where are the librato creds?
PARENT=$(ps -ocommand= -p $PPID | awk -F/ '{print $NF}' | awk '{print $1}')
START=$(date -d 'now' +%s)
OUT=$(${RP} ${@})
djosephsen / gist:8306440
Last active Jan 2, 2016 to librato via sh and shellbrato
View gist:8306440
#use to gather interesting metrics, and push them to librato
NP="/home/dave/tmp/ show --user dave --password XXX" # the command
source ${SBHOME}/ #the librato shell library
${NP} | egrep -w 'current_humidity|current_temperature|hvac_heater_state|target_temperature' | sed -e 's/\.\+: /:/'| while read METRIC
read NAME VALUE <<< $(echo ${METRIC} | tr ':' ' ')
[ "${VALUE}" == "True" ] && VALUE=1
You can’t perform that action at this time.