Skip to content

Instantly share code, notes, and snippets.

@philipithomas
philipithomas / Dockerrun.aws.json
Created Feb 28, 2017
Staffjoy Elastic Beanstalk Deploy Script
View Dockerrun.aws.json
{
AWSEBDockerrunVersion: "1",
Authentication: {
Bucket: "staffjoy-deploy",
Key: "docker.cfg"
},
Image: {
Name: "staffjoy/app:TAG",
Update: "true"
},
@philipithomas
philipithomas / letsencrypt_2016.md
Created Jul 24, 2016 — 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)
View letsencrypt_2016.md

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.

View gist:c50e20f2978013cac85d
# 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
View demo.py
@api.route('/blog', methods=['GET'])
def blog_xml():
return requests.get("https://engineering.opendns.com/?format=json&data=blog&post_count=1").text
@philipithomas
philipithomas / docker_knapsack.jl
Last active Aug 29, 2015
Docker Container Scheduling as a Knapsack Problem in Julia/JuMP
View docker_knapsack.jl
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": {
@philipithomas
philipithomas / whitelist.py
Last active May 17, 2017
Whitelist AWS Health Check IPs in Cloudflare
View whitelist.py
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 / Stack trace
Created Sep 1, 2014
Failing dictionary keys as variables
View Stack trace
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
View gist:f383ad65f948dc7a9a6a
-----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
View keybase.md

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: