Skip to content

Instantly share code, notes, and snippets.

View alfredfrancis's full-sized avatar

Alfred Francis alfredfrancis

View GitHub Profile
1. Setup a Twitter Developer account and create new App, get its consumer key and consumer secret and replace them below
2. Replace TWEETS_DB, QUERY, and LANGUAGE values
3. Install required packages: `pip install tweepy schedule`
4. Run process using `python`
import tweepy
import sqlite3
import datetime
#Original Author
import boto3
import pprint
import os
# Credentials & Region
access_key = os.environ["AWS_ACCESS_KEY_ID"]
secret_key = os.environ["AWS_SECRET_ACCESS_KEY"]
region = "us-east-1"
alfredfrancis / index.html
Created May 31, 2017 17:42 — forked from adunkman/index.html
Relay messages from RabbitMQ to a browser using
<!DOCTYPE html>
<script src="/"></script>
(function () {
var onMessage = function (data) {
// Do something with the message data
alfredfrancis /
Created April 21, 2017 17:31 — forked from mattupstate/
JSON Patch SQLAlchemy models w/ Flask
from dictalchemy import make_class_dictable
from flask import Flask, request, jsonify, json
from flask_sqlalchemy import SQLAlchemy
from jsonpatch import JsonPatch, JsonPatchException
app = Flask(__name__)
app.debug = True
db = SQLAlchemy(app)
alfredfrancis / react-firebase-auth.js
Created January 30, 2017 17:00 — forked from nateinaction/react-firebase-auth.js
This is a version of Facebook's React Conditional Rendering example modified to support firebase authentication.
* This is a version of Facebook's React Conditional Rendering
* example modified to support firebase authentication.
import React, { Component, PropTypes } from 'react';
import * as firebase from 'firebase';
function UserAvatar(props) {
alfredfrancis / gist:4b54c8eebc1e01815a5bac6bc555022d
Created June 23, 2016 10:48 — forked from fnielsen/gist:1226214
Email classification example with Python, NLTK, ...
documents = [ dict(
email=open("conference/%d.txt" % n).read().strip(),
category='conference') for n in range(1,372) ]
documents.extend([ dict(
email=open("job/%d.txt" % n).read().strip(),
category='job') for n in range(1,275)])
documents.extend([ dict(
email=open("spam/%d.txt" % n).read().strip(),
category='spam') for n in range(1,799) ])
import wiringpi
import time
# 1M external pull-up resistor
# 1) set pin low and to output to discharge
# 2) make the pin an input without the internal pull-up on
# 3) read input and see how long it takes to go high
# ref:
# pins: