Skip to content

Instantly share code, notes, and snippets.

View ardrian's full-sized avatar

Ardrian ardrian

View GitHub Profile
web: gunicorn app:app
# This file is used by pip to install required python packages
# Usage: pip install -r requirements.txt
# Flask Framework
Flask==0.12
# Gunicorn Web Server
gunicorn==19.7.1
@ardrian
ardrian / app.py
Created April 16, 2018 17:20
Basic Flask Example
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
import face_recognition
import glob, os
def contains_face(filename):
image = face_recognition.load_image_file(filename)
face_locations = face_recognition.face_locations(image)
return len(face_locations) > 0
def main():
@ardrian
ardrian / UpdateExpenses.py
Last active February 8, 2018 07:30
Update Splitwise group expenses
# This script wasn't completed. There is an authentication error returned when we attempt to update
# a transaction. The strange thing is that we are allowed to retrieve items with no problems,
# also if we send an invalid write, we receive an error response which makes sense (i.e. when
# Sum(user_costs) != expense_cost
#
# If we were finishing this script we would need to do the following:
# 1) Use a proper exchange rate
# 2) Detect when currency == JPY, only covert then
# 3) Update the currency value to AUD after the conversion
# 4) Some kind of logging in case we mess things up
@ardrian
ardrian / gist:dcb47afeb59cad0234eb
Last active August 29, 2015 14:14
Parse.com Mandrill Send with Promise
// This method sends an email via Mandrill. It returns a promise chain
// so that it can be more neatly included as part of a promise chain.
var sendMandrillEmailPromise = function(message,send_at){
var promise = new Parse.Promise();
Mandrill.sendEmail({
message: message,
async: true,
send_at: send_at
},{