This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ignores commented out lines and handles spaces | |
# https://stackoverflow.com/questions/19331497/set-environment-variables-from-file-of-key-pair-values | |
export $(grep -v '^#' .env | xargs -d '\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from MySQLdb import connect | |
conn = connect(user="[USER]", passwd= "[PASSWORD]") | |
cur = conn.cursor() | |
cur.execute("show databases;") | |
dbs_to_update = filter( | |
lambda db: db not in ('information_schema', 'mysql', 'performance_schema'), | |
[dbname[0] for dbname in cur.fetchall()]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dev only: | |
# Create migrations for any model changes that don't have migrations committed yet. | |
# Makes the migrations locally and push them up since we can't write files outside /tmp in Lambda | |
if [[ "${CIRCLE_BRANCH}" == "dev" ]] | |
then | |
python manage.py makemigrations --name ${CIRCLE_BRANCH}_`date "+%Y%m%d-%H%M%S"` --settings=app.settings.production | |
fi | |
zappa update -s config/zappa_settings.json ${CIRCLE_BRANCH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import os | |
import subprocess | |
# Script taken from doing the needed operation | |
# (Filters > Remeshing, Simplification and Reconstruction > | |
# Quadric Edge Collapse Decimation, with parameters: | |
# 0.9 percentage reduction (10%), 0.3 Quality threshold (70%) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For functions with existing arguments | |
:%s/def \(.\+\)(\(.\+\)):/def \1(self, \2):/ | |
# For functions with no arguments | |
:%s/def \(.\+\)():/def \1(self):/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Physics simulation with PyODE followed by a (basic) rendering with Vapory | |
See the result here: http://i.imgur.com/TdhxwGz.gifv | |
Zulko 2014 | |
This script is placed in the Public Domain (Licence Creative Commons 0) | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Physics simulation with PyODE followed by a (basic) rendering with Vapory | |
See the result here: http://i.imgur.com/TdhxwGz.gifv | |
Zulko 2014 | |
This script is placed in the Public Domain (Licence Creative Commons 0) | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ ! -f .env ] | |
then | |
export $(cat .env | xargs) | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
logging.basicConfig(format='%(levelname)s:%(message)s') | |
log = logging.getLogger(__name__) | |
log.setLevel(logging.INFO) | |
def main(): | |
log.info("Great info") | |
log.debug("You won't see this") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# Install the SciPy stack on Amazon Linux and prepare it for AWS Lambda | |
yum -y update | |
yum -y groupinstall "Development Tools" | |
yum -y install blas --enablerepo=epel | |
yum -y install lapack --enablerepo=epel | |
yum -y install atlas-sse3-devel --enablerepo=epel | |
yum -y install Cython --enablerepo=epel |