Skip to content

Instantly share code, notes, and snippets.

Avatar

Heath Robinson ubiquitousthey

View GitHub Profile
@ubiquitousthey
ubiquitousthey / reflect.py
Last active Aug 2, 2018 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
View reflect.py
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
# Added to by Heath Robinson (2018)
from http.server import HTTPServer, SimpleHTTPRequestHandler, HTTPStatus
import argparse
import os
import hashlib
View Interview Problem.md

Problem

You have two files - names.txt and characters.txt.

The characters.txt file contains all the characters needed to spell two names from the names.txt file.

When the correct names are found:

  • Every character from characters.txt will be used exactly once
  • There will be no unused characters
View keybase.md

Keybase proof

I hereby claim:

  • I am ubiquitousthey on github.
  • I am ubiquitousthey (https://keybase.io/ubiquitousthey) on keybase.
  • I have a public key ASBcgKxP0HKCHTrxAA5u8pgxcxtsx7Dj7yvQD7RS0tHtlgo

To claim this, I am signing this object:

@ubiquitousthey
ubiquitousthey / readline.js
Created Nov 12, 2015
Read Lines from file in Node.js
View readline.js
var fs = require('fs')
var nameFilename = 'names.txt'
function readLines(filename,fn) {
var stream = fs.createReadStream(filename, {encoding: 'utf8'})
var fileData = ''
stream.on('data', function(data) {
fileData += data;
var lines = fileData.split('\n');
lines.forEach(function(line) {
View network_addr.rb
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Copyright:: Copyright (c) 2011 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@ubiquitousthey
ubiquitousthey / gist:55766936f2194a1dee53
Last active Aug 29, 2015
Integrity DevOps Interview Tasks
View gist:55766936f2194a1dee53

Mod Rewrite Problems

  1. There is a bug in a javascript file that is that is incorrectly routing links to /MySite/Page1 to /MySite/test/Page1
  2. Use mod_rewrite to send mobile users to a mobile site

Edting Configuration Files

  1. Take the file located at the URL below and convert it to yaml and XML and an INI file (You may create your own schema for xml and ini as long as it is valid
  2. https://s3.integrityops.net.s3.amazonaws.com/config.json?AWSAccessKeyId=AKIAIIVV32RH467E7TDQ&Expires=1414175299&Signature=o8NyGMMkIsZR59MAP1hosrJ4yvM%3D

AWS + Linux

  1. Sign up for the AWS Free Teir
@ubiquitousthey
ubiquitousthey / gist:8138928
Last active Jan 1, 2016
Generate Postgres stackdriver config with multiple databases
View gist:8138928
#!/usr/bin/env python
import tempfile
import psycopg2
import psycopg2.extras
opening = """
LoadPlugin postgresql
<Plugin postgresql>
"""
@ubiquitousthey
ubiquitousthey / clean_vhosts.py
Last active Dec 10, 2015
Cleanup RabbitMQ Virtual Hosts
View clean_vhosts.py
#!/usr/bin/env python
import httplib
import base64
import json
auth = base64.encodestring('{0}:{1}'.format('guest','guest'))
headers = {'Content-type':'application/json','Authorization':'Basic {0}'.format(auth)}
def remove_vhost(vhost):
@ubiquitousthey
ubiquitousthey / gist:3659297
Created Sep 6, 2012
Deferred Usage with node
View gist:3659297
//Usage
DeferredPromise<MedicalRecord> mrDef = mgr.get(MedicalRecord.class, mrid);
DeferredPromise<Problem> pDef = mgr.get(Problem.class, pid);
// Implicit Error Handling (Red Bar)
Deferred.when(mrDef, pDef).then(new EmrDeferredCommand(){
@Override public void doOnSuccess(){
MedicalRecord mr = mrDef.getResult();
Problem p = pDef.getResult();
// yadda yadda yadda
@ubiquitousthey
ubiquitousthey / gist:2003245
Created Mar 8, 2012
Class to support rendering an enumeration.
View gist:2003245
enum ECGRhythms implements {
NORMAL_SINUS_RHYTHM("Normal sinus rhythm",1),
PACEMAKER("Pacemaker",2),
FREQUENT_PVCS("Frequent PVCs",3),
ATRIAL_FIBRILLATION("Atrial fibrillation", 5),
OTHER("Other", 6);
String display;
int value;
ECGRhythms(String display, int value) {