Skip to content

Instantly share code, notes, and snippets.

View nmische's full-sized avatar

Nathan Mische nmische

  • Philadelphia, PA
  • 01:39 (UTC -05:00)
View GitHub Profile
@nmische
nmische / keybase.md
Last active June 11, 2018 18:18
Keybase Proof

Keybase proof

I hereby claim:

  • I am nmische on github.
  • I am nmische (https://keybase.io/nmische) on keybase.
  • I have a public key whose fingerprint is B0D6 2F20 F79E D694 13D4 41B7 5E3E E9A3 7E57 35CD

To claim this, I am signing this object:

wrench
hosts
-i --include-context comma delimited string of regular expression strings
-x --exclude-context comma delimited string of regular expression strings
-d --data-centers list of datacenters
"datacenter ip hostname"
@nmische
nmische / storage.cf
Created January 8, 2015 21:17
Storage CFEngine Example
bundle agent netapp_nfs(server, source) {
storage:
"/data"
mount => netapp_mount($(server), $(source)),
classes => classes_generic("netapp_nfs");
}
body mount netapp_mount(server, source) {
mount_type => "nfs";
mount_server => "$(server)";
@nmische
nmische / test.sh
Created December 4, 2014 04:09
nc test for failure
nc -v -z -w 3 google.com 80 &> /dev/null && echo "Online" || echo "Offline"
@nmische
nmische / jdk8.md
Created September 10, 2014 22:48
Rename oracle jdk package

Using a Vagrant box (chef/centos-7.0) as the build server:

$ yum install rpm-build

... get rpmrebuild rpm from sourceforge

$ rpm -Uvh rpmrebuild-2.11-1.noarch.rpm

... get oracle jdk rpm from oracle

@nmische
nmische / bootstrap.sh
Created August 12, 2014 14:13
CFEngine 3.3.9 Bootstrap
#! /bin/sh
cf-agent --bootstrap --policy-server 10.0.2.15
@nmische
nmische / convert-to-utf8.groovy
Created May 27, 2014 15:00
A script to convert files to UTF-8.
new File('~/tmp').eachFile {
def toolkit = new CharsetToolkit(it)
def cs = toolkit.getCharset().toString()
def filePath = it.path + '/' + it.name
println filePath + ': ' + cs
if (cs != 'UTF-8') {
def content = it.getText(cs)
it.write(content ,'UTF-8')
@nmische
nmische / sorting_fun_01.py
Last active August 29, 2015 13:57
Chain a list of tuples.
# We can sort using a custom adjacency index that allows us to pick the starting node.
tickets = [('PHL','NYC'),('IAD','PHL'),('SFO','IAD'),('NYC','SFO')]
sortedTickets = []
index = {}
for t in tickets:
if t[0] not in index:
index[t[0]] = t
def getNext(ticket):
@nmische
nmische / dedupe.sh
Created March 19, 2014 17:32
One liner to remove items in dupes.txt from full.txt
comm -23i <(cat full.txt | sort | uniq -i) <(cat dupes.txt | sort | uniq -i)