Skip to content

Instantly share code, notes, and snippets.

View dgoradia's full-sized avatar

Dru Goradia dgoradia

  • Honeybee Health
  • Los Angeles, CA
View GitHub Profile
@dgoradia
dgoradia / ssm_parameter_store.py
Created September 7, 2018 01:23 — forked from nqbao/ssm_parameter_store.py
Python class to provide a dictionary-like interface to access AWS SSM Parameter Store easily
# Copyright (c) 2018 Bao Nguyen <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
@dgoradia
dgoradia / README.md
Created January 27, 2018 08:31 — forked from binwiederhier/README.md
OpenSSH 6.6p1 patch: AuthorizedKeysCommand with additional argument <fingerprint>

Make and run

apt-get source openssh-server
apt-get install libssl-dev 
cd openssh-6.6p1

# Apply patch
patch -p1 openssh/openssh-6.6p1/auth2-pubkey.c < auth2-pubkey.c.patch
@dgoradia
dgoradia / Makefile
Created January 6, 2018 08:14 — forked from turtlemonvh/Makefile
Golang Project Makefile Template
# Borrowed from:
# https://github.com/silven/go-example/blob/master/Makefile
# https://vic.demuzere.be/articles/golang-makefile-crosscompile/
BINARY = superdo
VET_REPORT = vet.report
TEST_REPORT = tests.xml
GOARCH = amd64
VERSION?=?
@dgoradia
dgoradia / self-update-script.py
Created January 4, 2018 07:34 — forked from gesquive/self-update-script.py
Stick this in a python script to self update the script from an online source
def update(dl_url, force_update=False):
"""
Attempts to download the update url in order to find if an update is needed.
If an update is needed, the current script is backed up and the update is
saved in its place.
"""
import urllib
import re
from subprocess import call
def compare_versions(vA, vB):
@dgoradia
dgoradia / spinner.py
Created January 4, 2018 07:33
Python spinner
#!/usr/bin/env python
"""A module which provides spinners for indicating that a process is running.
These are most useful when you want to provide user feedback that something
is happening but you can't provide a good progress bar.
Known limitations:
If your prompt is longer than the width of your terminal it will wrap, causing
the animation to not work properly. In most cases this probably isn't a big
deal.
@dgoradia
dgoradia / cmd.py
Created January 3, 2018 08:26 — forked from dhrrgn/cmd.py
Running a command in Python and optionally processing the output in realtime.
import shlex
import subprocess
import sys
def run_cmd(cmd, callback=None, watch=False):
"""Runs the given command and gathers the output.
If a callback is provided, then the output is sent to it, otherwise it
is just returned.
@dgoradia
dgoradia / packer-ami-id
Created January 1, 2017 04:14 — forked from danrigsby/packer-ami-id
Get AMI ID from a packer build
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt
@dgoradia
dgoradia / ruby_csr_example.rb
Created February 2, 2016 02:12 — forked from mitfik/ruby_csr_example.rb
Ruby example of CSR with openssl
require 'openssl'
def gen_key(name)
key = OpenSSL::PKey::RSA.new 1048
file = File.new(name, "w")
file.write(key)
file.close
end
def get_key(name)