Skip to content

Instantly share code, notes, and snippets.

View whalesalad's full-sized avatar
:shipit:
the patients are running the asylum

Michael Whalen whalesalad

:shipit:
the patients are running the asylum
View GitHub Profile
### Keybase proof
I hereby claim:
* I am whalesalad on github.
* I am whalesalad (https://keybase.io/whalesalad) on keybase.
* I have a public key whose fingerprint is 7268 EB32 8956 B5E5 0F35 B020 8FF1 205B 3535 DED5
To claim this, I am signing this object:
@whalesalad
whalesalad / flask_utils.py
Created November 14, 2016 21:00
Some of my favorite little utility methods useful with Flask api development.
import json
import datetime
from functools import wraps
from flask import request, jsonify
class ISO8601Encoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime.datetime):
@whalesalad
whalesalad / .psqlrc
Created October 26, 2016 14:14
~/.psqlrc
\timing
\set PROMPT1 '%[%033[33;1m%]%x%[%033[0m%]%[%033[1m%]%/%[%033[0m%] %m %R%# '
\pset null 'NULL'
\pset border 2
\x auto
\set HISTCONTROL ignoredups
\set COMP_KEYWORD_CASE upper

GDAL on OS X

This will resolve issues with GDAL on OS X in your virtualenv:

  • brew install gdal
  • From OUTSIDE a virtualenv (try, deactivate), run this command to find your system site-packages directory: python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
    • Chances are this will be /Library/Python/2.7/site-packages
    • Note: this is where pip install ... packages are placed
  • Copy the gdal-XXX.pth file to the site-packages directory of your virtual environment.
  • Find your site packages directory for your virtual env by running the earlier command, python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())", from inside an activated virtualenv.
class EditableFieldNameComponent extends React.Component {
constructor(props) {
super(props);
this.model.on(`change:${this.attribute}`, function(x, value, y) {
this.setState({text: value});
}.bind(this));
this.state = {
editing: this.props.editing || false,

Install Updates

sudo apt-get -y update && sudo apt-get -y upgrade

Add Docker key

sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

Add Docker to apt sources

@whalesalad
whalesalad / interview_answers.md
Created October 25, 2015 22:02
Some interview answers from a long time ago that I found on my desktop

A description of your own favorite software project (code is a bonus)

If I had to pick one of my public repositories, it would probably be this one: https://github.com/whalesalad/arbesko-hornet

It's my favorite because it was pretty fun to build and ended up providing a lot of value to the customer that I built it for. The goal of the project was to allow less-technical members of Arbesko's web team to simply upload high-res images to an FTP folder and then have those processed/resized/cropped/etc... into the various formats needed for the website.

It runs inside of a Docker container because most of their infrastructure is not Ruby. It used to do a lot more (using the psd.rb library to take PSD's and covert those) but ultimately that was nixed due to some incompatible and very old PSD files.

It's also a fairly modern project of mine, so it reflects my style more.

/*
** Farmers Insurance -- farmers.room.js
** (c) 2011 ZehnerGroup // Written by Michael Whalen <[email protected]>
** zehnergroup.com
*/
var RoomController, Room;
RoomController = Class.$extend({
__init__: function(a, b) {
var c = this;
c.frame = $("#primaryFrame");
from random import randrange
import re
import urllib
socket = urllib.urlopen("http://www.youporn.com/random/video/")
htmlSource = socket.read()
socket.close()
result = re.findall('<p class="message">((?:.|\\n)*?)</p>', htmlSource)
print
print result[randrange(len(result))]
print
# Copyright (c) Microsoft Corporation. All rights reserved.
"""Authorization helper functions.
"""
from hashlib import sha256
import hmac
import pydocumentdb.http_constants as http_constants