Skip to content

Instantly share code, notes, and snippets.

View mikeblum's full-sized avatar
🥝

Michael Blum mikeblum

🥝
View GitHub Profile
@mikeblum
mikeblum / backboneSync
Created February 15, 2014 22:31
Override backbone sync
sync: function (method, model, options) {
Backbone.sync.call(method, model, options);
}
//from http://stackoverflow.com/a/18839219/1377866
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Single-Column Responsive Email Template</title>
<style>
@media only screen and (min-device-width: 541px) {
.content {
@mikeblum
mikeblum / zk-solr-deployment.yml
Created January 6, 2016 23:26
docker-compose script for creating a distributed SolrCloud cluster on AWS ECS
zookeeper:
image: "987737556516.dkr.ecr.us-east-1.amazonaws.com/tsgrp/zookeeper"
cpu_shares: 100
ports:
- "2181:2181"
container_name: "zookeeper"
hostname: "zookeeper"
solr1:
image: solr
@mikeblum
mikeblum / states_hash.json
Last active March 31, 2016 18:16 — forked from mshafrir/states_hash.json
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@mikeblum
mikeblum / default.rb
Last active July 3, 2016 18:50
Chef recipe for creating a Solr instance
# recipes/default.rb
# Cookbook Name:: apache_solr
# Recipe:: default
#
# Copyright 2016, Michael Blum
#
if node['solr']['install_java']
include_recipe 'java_se'
end
@mikeblum
mikeblum / logger.py
Last active October 4, 2016 22:24
My goto Python logging template - lints 10/10 in pylint
#!/usr/bin/env python
"""
Global Python log configuration settings
@author mblum
"""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
@mikeblum
mikeblum / Vagrantfile
Created January 30, 2017 15:47
Clustered RabbitMQ installation
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# config.vm.box = "bento/ubuntu-16.04"
config.vm.box = "ubuntu/trusty64"
# RabbitMQ ports
config.vm.network :forwarded_port, guest: 5672, host: 5672
config.vm.network :forwarded_port, guest: 5673, host: 5673
@mikeblum
mikeblum / authors.py
Created March 17, 2017 14:30
Create an authors.txt file for migrating from SVN to GIT using svn2git
import argparse
import subprocess
import sys
def main():
'''
Parse all SVN authors from the repository and append the specified domain
'''
parser = argparse.ArgumentParser(description='Collate all SVN comitters / authors with an email address.')
parser.add_argument('-domain', metavar='-d', help='e.x. tsgrp.com')
@mikeblum
mikeblum / deploy.sh
Created July 4, 2017 01:09
Deploying a Hugo blog to S3
#!/bin/bash
export S3_BUCKET=
# clean public build dir
rm -rf public
# rebuild site
hugo
# destructively sync with S3 bucket
# (anything not mirrored on the local filesystem will be deleted)
aws s3 sync public/ s3://$S3_BUCKET/ --delete
@mikeblum
mikeblum / package_and_deploy_lambda_function.sh
Created July 3, 2016 04:00
Deploy Python Lambda fucntions to AWS
#!/bin/bash
# expects the lambda function .py file to be in the same directory as this script.
# based off of Amazon's official documentation:
# http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-deployment-pkg.html#with-s3-example-deployment-pkg-python
# get the lambda function
lambda_func_file=$1
lambda_func="${lambda_func_file%.*}"
# exit if no file specified
[[ -z "$1" ]] && { echo "Lambda function is empty" ; exit 1; }
# generate a deployment timestamp