Skip to content

Instantly share code, notes, and snippets.

View axpence's full-sized avatar

Alex Spencer axpence

View GitHub Profile
import os
from celery import Celery
from celery.schedules import crontab
# import django
# django.setup()
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
import random
class ThbkCommentsGenerator:
'''
creates comments B A B A Y
'''
heart_eyes_emoji = u'\U0001F60D'
raised_hands = u'\U0001F64C'
thumbs_up = u'\U0001F44D'
face_blowing_a_kiss = u'\U0001F618'
//3 servers:
1) Neural Queue - (Former heroku server)
App communicates with: [EBS] -> EC2 -> RDS //runs the queue (Scala + Play)
2) G2 Server - Machine Learning one
[Docker Image] -> EC2 ->
3) G2 Training server [EC2]
-takes as input style images and outputs model files. Server must be started and stopped every time. Process is completely manual.
# Enter your code here. Read input from STDIN. Print output to STDOUT
import sys
n = raw_input('')
lines = [line.strip() for line in sys.stdin]
print(n)
print(lines)
{
"stateMachineName" : "DAY_1",
"states": [
{
"name": "START",
"postEnterActions": [
{
"actionType": "MESSAGE",
"data": {
"message": "Welcome to 30 Days of Gratitude!\nDAY 1: HOME\nThey say home is where the heart is, but what does \"home\" mean to you? Is it where you rest your head each night? Is it where you grew up? Or is home more of a state of mind? Whatever home means to you, reflect on it and share a photo of it today.\nSo tell us, where is home?"
<?xml version="1.0" encoding="UTF-8"?>
<survey name="EventStateMachine24006">
<node id="INITIAL_STATE" day="1" linkToFile="https://s3-us-west-2.amazonaws.com/eventz-vcards/Gather_SG_3.vcf" onEnterAction="MMS" expectedResponseType="range" body="I'm here to make the Startup Grind Global Conference the best event ever.\n\nAsk me any question you can think of, or choose an option below (1-3)\n\n1) Check schedule\n2) Search for attendee contact info\n3) Share your contact info with attendees">
<node id="CHECK_SCHEDULE_SCALA" onEnterAction="SMS" expectedResponseType="range" preGuardTransitionValues="1,1)" postGuardTransitionLambda="heartbeat-js-GetSchedule" body="">
<pointer id="GO_BACK_TO_CHECK_SCHEDULE_SCALA_3" onEnterAction="NONE" preGuardTransitionValues="1,1)" transitionToState="CHECK_SCHEDULE_SCALA"></pointer>
<pointer id="GO_BACK_TO_LOOKUP_OTHERS_CONTACT_INFO_3" onEnterAction="NONE" preGuardTransitionValues="2,2)" transitionToState="LOOKUP_OTHERS_CONTACT_INFO"></pointer>
<pointer id="G
@axpence
axpence / broadcastToSNS.js
Created February 23, 2016 09:59
broadcastToSNS.js
function broadcastToSNS(event,stateMachineName,currentStateProperties,validTransition,cb){
//SNS for lambda chat
var sns = new AWS.SNS();
var payload = event;
if(event.broadcastEventType === BroadcastEventTypes.fromOutgoingMessage) {
payload.channel = event.outGoingMessage.toNumber;//channel is partition key on dynamo for UI.
payload.fromNumber = event.outGoingMessage.fromNumber;
payload.toNumber = event.outGoingMessage.toNumber;
from __future__ import print_function
import json
import requests
import re
import boto3
from random import choice
from string import ascii_uppercase
import os
@axpence
axpence / marc.html
Created February 16, 2016 06:37
marc
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">
@axpence
axpence / sm_paraguay.xml
Created February 11, 2016 06:34
paraguay SM
<?xml version="1.0" encoding="UTF-8"?>
<survey name="ParaguayStateMachine">
<node id="INITIAL_STATE" day="1" linkToFile="https://www.homelessworldcup.org/wp-content/uploads/2015/03/PartnerPage_Paraguay_logo.jpg" onEnterAction="MMS" expectedResponseType="range" body="Which agriculture school did you attend?">
<node id="AREA_PRODUCTION" onEnterAction="SMS" expectedResponseType="range" preGuardTransitionValues="regex=(.*?)" body="What are you responsible for? \n\n1=Egg Production\n2=Milk\n3=Tomatoes\n4=Corn">
<node id="EGG_PRODUCTION" onEnterAction="SMS" expectedResponseType="range" preGuardTransitionValues="regex=1" body="How many eggs did you produce?">