Skip to content

Instantly share code, notes, and snippets.

View mmautner's full-sized avatar
🌊
chilling

Max Mautner mmautner

🌊
chilling
View GitHub Profile
@mmautner
mmautner / jokes-vs-spy-chart.ipynb
Created December 11, 2021 22:31
"jokes" search volume vs. $SPY prices, 2008-2021
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mmautner
mmautner / imagemagick-gif.sh
Last active April 12, 2018 07:16
make a simplistic multi-frame animation with Python + ffmpeg
#!/bin/bash
convert -loop 0 -delay 30 -resize 683x512\! *.png out.gif
@mmautner
mmautner / Dockerfile
Created December 17, 2017 07:05
celery docker-compose example
FROM python:3.4
ADD . /app/
WORKDIR /app/
RUN pip install -r requirements.txt
CMD ["echo", "hello"]
@mmautner
mmautner / resource_alloc_docker.md
Last active March 29, 2017 23:10 — forked from afolarin/resource_alloc_docker.md
Resource Allocation in Docker

Container Resource Allocation Options in docker-run

You have various options for controlling resources (cpu, memory, disk) in docker. These are principally via the docker-run command options.

Dynamic CPU Allocation

-c, --cpu-shares=0         
CPU shares (relative weight, specify some numeric value which is used to allocate relative cpu share)
@mmautner
mmautner / send_ses_email.sh
Created November 9, 2016 06:38
Send an email via the AWS CLI (using Amazon SES)
text="test email
testing
-Max Mautner"
aws ses send-email \
--from ses-validated@address.com \
--to max@example.com \
--subject "Testing" \
--text "$text"
{
"name": "stout-example",
"authors": [
"Max Mautner"
],
"description": "",
"main": "",
"moduleType": [],
"license": "MIT",
"homepage": "",
@mmautner
mmautner / app.js
Created July 29, 2015 21:57
tool-time SPA w/ ui-router (bower install to install dependencies)
var app = angular.module('demoApp', ['ui.router']);
app.config(['$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {
$stateProvider.state('home', {
url: '/',
controller: 'MainController',
template: '<h1>hello {{value}}!</h1>'
});
@mmautner
mmautner / redshift.py
Last active July 11, 2023 17:41
Redshift Upserts w/ Python
import uuid
import psycopg2
from secret import REDSHIFT_CREDS
from secret import AWS_ACCESS_KEY, AWS_SECRET_KEY
def get_primary_keys(tablename, db):
c = db.cursor()
sql = "select indexdef from pg_indexes where tablename = '%s';" % tablename
c.execute(sql)
result = c.fetchall()[0][0]
@mmautner
mmautner / app.py
Last active August 29, 2015 14:04
demo rest api blurb
from flask import Flask
from flask.ext.sa_restful import SaApi
from models import Todo
app = Flask(__name__)
api = SaApi(app, url_prefix='/api/v0.1')
# registers GET/POST/DELETE/PUT endpoints at '/api/v0.1/todos' (tablename used for url by default)
api.add_resource(Todo)
#!/usr/bin/env python
import pandas as pd
df = pd.read_csv('users.csv')
def flatten(user_df):
new_user_df = pd.DataFrame()
new_user_df['userid'] = user_df.userid
for send_number, row in user_df.set_index('send_number').iterrows():