Skip to content

Instantly share code, notes, and snippets.

View mbaltrusitis's full-sized avatar
🕴️
-

Matthew Baltrusitis mbaltrusitis

🕴️
-
View GitHub Profile
{
"Description": "Base Template to create Neptune Stack inside a VPC",
"Parameters": {
"Env": {
"Description": "Environment tag, e.g. prod, nonprod.",
"Default": "test",
"Type": "String",
"AllowedPattern": "[a-z0-9]+",
"MaxLength": 15
},
@mbaltrusitis
mbaltrusitis / .editorconfig
Last active November 9, 2018 15:28
narrativ editorconfig example
# EditorConfig helps developers define and maintain consistent coding styles
# between different editors and IDEs. See more and available editor plugins at:
# https://editorconfig.org/#download
#
# Below are some defaults for Narrativ developers, with required values are
# marked as such. Everything else is may be updated to your personal
# preference.
# remove // set to false if project-specific
root = true
@mbaltrusitis
mbaltrusitis / pascals_triangle.py
Created March 19, 2017 20:54
Given n, generate that many lines of Pascal's Triangle.
#!/usr/bin/env python3
import sys
def PascalsTriangle(row):
max_row = int(row)
triangle = []
current_row = 0
@mbaltrusitis
mbaltrusitis / py-request.py
Last active February 6, 2017 20:07
A quick and dirty URL request and JSON decoding/deserialization.
import json
from urllib import request
from pprint import pprint
def main():
weather_req = request.urlopen("http://api.wunderground.com/api/872a930f94a85692/conditions/q/UK/London.json")
# read the request and decode the bytes into sensible UTF-8 strings
weather_data = weather_req.read().decode("utf-8")
# take a peak at the mess of it
@mbaltrusitis
mbaltrusitis / bracket-madness.py
Last active March 17, 2016 18:29
A random bracket selector.
#!/usr/bin/python
"""Randomly select your March Madness bracket.
"""
import random
south = (
(
@mbaltrusitis
mbaltrusitis / pip-virtualenv.sh
Last active March 15, 2016 22:00
Get pip and virtualenv into your system Python if they aren't already. This will also create a virtualenv as an example at $APP_Path.
#!/bin/bash
APP_PATH=$HOME/app
PYTHON_KERNEL=$APP_PATH/venv/bin/python
function install_pip {
echo -e 'downloading pip...'
curl -SLO https://bootstrap.pypa.io/get-pip.py
echo -e 'installing pip...'
python get-pip.py
@mbaltrusitis
mbaltrusitis / arg_stomp.py
Last active February 1, 2016 21:14
Keep running a method until I have enough arguments.
#!/usr/local/bin/python3
import inspect
import random
class Foo(object):
def a_method(self, x, y, z):
print('Your method ran:\n', x, y, z)
@mbaltrusitis
mbaltrusitis / git-new-workdir.sh
Created November 4, 2015 23:11
The contribute/git-new-workdir script from the git source. Super useful GitHub pages workflow.
#!/bin/sh
usage () {
echo "usage:" $@
exit 127
}
die () {
echo $@
exit 128
@mbaltrusitis
mbaltrusitis / main.py
Last active October 26, 2015 15:27
Update Variable Depth Dictionary
import collections
from pprint import pprint
my_dict = {
'one': {
'one-one': True,
'one-two': False,
'one-three': {
'one-three-one': True,
},
@mbaltrusitis
mbaltrusitis / sftp-config.json
Created July 3, 2015 20:49
Sublime SFTP package settings for remote server development
{
// Matt's Sublime SFTP settings for developing on a remote server
// This setup assumes you are using both an SSH key (as you should) and SFTP
// sftp, ftp or ftps
"type": "sftp",
"sync_skip_deletes": false,
"sync_same_age": true,
"confirm_downloads": false,