Skip to content

Instantly share code, notes, and snippets.

View dbazile's full-sized avatar

David Bazile dbazile

View GitHub Profile
@dbazile
dbazile / s3.sh
Created January 22, 2017 05:44 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
#!/bin/bash -e
cmd=$(basename $0)
################################################################################
. "$(dirname $0)/.aws-credentials"
[ "$SECRET" ] || { echo "$cmd: SECRET cannot be empty"; exit 1; }
[ "$KEY" ] || { echo "$cmd: KEY cannot be empty"; exit 1; }
@dbazile
dbazile / create-s3-website.bash
Last active July 15, 2018 03:18
create an s3 website the crazy way
#!/bin/bash -e
cmd=$(basename $0)
################################################################################
. "$(dirname $0)/.aws-credentials"
[ "$SECRET" ] || { echo "$cmd: SECRET cannot be empty"; exit 1; }
[ "$KEY" ] || { echo "$cmd: KEY cannot be empty"; exit 1; }
import json
import logging
import os
import shutil
import subprocess
import tempfile
import xml.etree.ElementTree as etree
import zipfile
import arrow
class MapDelegate {
constructor({ onPointClick }) {
this.layers = L.featureGroup()
this.control = L.control()
}
install(map) {
map.addLayer(this.layers)
map.addControl(this.control)
}
const ALPHA_FETCH = 'ALPHA_FETCH'
const ALPHA_FETCH_SUCCESS = 'ALPHA_FETCH_SUCCESS'
const BRAVO_FETCH = 'BRAVO_FETCH'
const BRAVO_FETCH_SUCCESS = 'BRAVO_FETCH_SUCCESS'
const fetchAlphaEpic = (action$) =>
action$.ofType(ALPHA_FETCH)
.mergeMap(() => Observable.ajax('http://httpbin.org/get?alphaId=1234'))
.map(res => res.response)
import re
pattern = re.compile(
"""
[ :]{0,3}
(\d)? # country code
[\. \-]{0,3}
\(?(\d{3})\)? # area code
[\. \-]?
(\d{3}) # routing prefix
@dbazile
dbazile / joiner.py
Last active November 17, 2017 00:10
import glob
import json
import re
import os
JSON_OUTFILE = 'feature_collection.json'
JAVASCRIPT_OUTFILE = 'map-layer.js'

Abstract CI/CD Pipeline Design

This is an abstract CI/CD pipeline design that optimizes for blue/green deployments, repeatable builds and bakes in the ability to rapidly deploy a hotfix in emergencies.

Parameters

@dbazile
dbazile / map-delegate.js
Last active April 19, 2018 20:39
"map delegate" reference implementation
import L from 'leaflet'
import { clearDelegate, setDelegate, flyToBounds } from '../../primary-map'
import pointMarkerImage from '../../images/point_marker.svg'
const POINT_MARKER_ICON = L.icon({
iconUrl: pointMarkerImage,
iconSize: [30, 15],
iconAnchor: [14, 15],