Skip to content

Instantly share code, notes, and snippets.

@philipithomas
philipithomas / hack.sh
Last active August 29, 2015 14:02 — forked from erikh/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#

Keybase proof

I hereby claim:

  • I am philipithomas on github.
  • I am philipithomas (https://keybase.io/philipithomas) on keybase.
  • I have a public key whose fingerprint is 2742 E1F6 F4F3 38D4 C541 73EC FE01 51EC 38D8 9319

To claim this, I am signing this object:

This file has been truncated, but you can view the full file.
{"vehicles": {"uber": [{"sum": {"passengersAssigned": 21624, "groupsAssigned": 16559, "groups": 50099, "passengers": 64136}, "stateCount": {"drivingUnoccupied": 0, "holdingUnoccupied": 16559, "holdingOccupied": 50043, "idle": 55, "drivingOccupied": 56}, "sumSquared": {"passengersAssigned": 134790, "groupsAssigned": 149985, "groups": 183525, "passengers": 141414}}, {"sum": {"passengersAssigned": 21597, "groupsAssigned": 17589, "groups": 49016, "passengers": 62126}, "stateCount": {"drivingUnoccupied": 0, "holdingUnoccupied": 17589, "holdingOccupied": 48962, "idle": 54, "drivingOccupied": 54}, "sumSquared": {"passengersAssigned": 140363, "groupsAssigned": 150907, "groups": 182334, "passengers": 149096}}, {"sum": {"passengersAssigned": 22636, "groupsAssigned": 16696, "groups": 49976, "passengers": 69155}, "stateCount": {"drivingUnoccupied": 0, "holdingUnoccupied": 16696, "holdingOccupied": 49922, "idle": 54, "drivingOccupied": 54}, "sumSquared": {"passengersAssigned": 136972, "groupsAssigned": 150148, "groups": 1
-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v0.3.1
Comment: https://keybase.io/crypto
wcBMA9raESnnokplAQf/VpsIIEYm6hJ7MRTeNfAG037VTsZqP479zY3SfrMgW9WS
/66/z/p2LFboQB7GR5E/oAeYB+svnZ12xAPimMHgznmBL7CeHKl/v8AduiXR6OUh
si2e9qmgYheuwOmr1Nfvji5P99BntxGIZe3iB0Y5SftHhUM9ljnnvaTPcU7cjNN2
HNOUjdvbTOEuJE5gqyfVxgRuFtY+IrdPSDQNzDZ+dBKCcuju0emuERa72m9bHHwa
NkH/Tq6X+ghS9ijMznYMXDb1IvlnER1FPq9jMQeX2pk/LbChxi73iZf3RZQLMp4G
7eLZE/B9iScwgko16/SKwF49m3bqBHsDpAdVJs3qx9LA8gGXRCg0MqY8Cn2sp4dD
@philipithomas
philipithomas / Stack trace
Created September 1, 2014 15:57
Failing dictionary keys as variables
ERROR: key not found: "x"
in getindex at dict.jl:615
in getindex at no file
in include at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib
in include_from_node1 at loading.jl:128
in process_options at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib
in _start at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib (repeats 2 times)
while loading /path/to/file/test.jl, in expression starting on line 239
@philipithomas
philipithomas / whitelist.py
Last active May 17, 2017 15:40
Whitelist AWS Health Check IPs in Cloudflare
import requests
import netaddr
ranges = [
"54.183.255.128/26",
"54.228.16.0/26",
"54.232.40.64/26",
"54.241.32.64/26",
"54.243.31.192/26",
"54.244.52.192/26",
@philipithomas
philipithomas / docker_knapsack.jl
Last active August 29, 2015 14:20
Docker Container Scheduling as a Knapsack Problem in Julia/JuMP
using JuMP
using Cbc
#=
We pass in the variable "pools" in this format that goes through a separate
pre-processing script that pipes JSON to a Julia JSON loader.
{
"awesome-pool-prod": {
@api.route('/blog', methods=['GET'])
def blog_xml():
return requests.get("https://engineering.opendns.com/?format=json&data=blog&post_count=1").text
# Goal: write Julia logs to disk and also print to standard out.
# In the process, prepend environment info (staffjoy-scheduler-stage)
# This works in vagrant / dev
/usr/bin/julia -p 2 -e 'import Manager; Manager.run_server()' 2>&1 | awk -v env=$ENV '{ print "staffjoy-scheduler-" env, $0; }' | tee -a scheduler.log
# In docker, the awk fails. The environment variable is defined.
# This is all that works in docker:
/usr/bin/julia -p 2 -e 'import Manager; Manager.run_server()' 2>&1 | tee -a scheduler.log
@philipithomas
philipithomas / letsencrypt_2016.md
Created July 24, 2016 02:42 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two modes when you don't want Certbot to edit your configuration:

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80) to renew certificates.

In the following, we're setting up mydomain.com to be served from /var/www/mydomain, and challenges will be served from /var/www/letsencrypt.