Skip to content

Instantly share code, notes, and snippets.

Working from home

Alfred Francis alfredfrancis

Working from home
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
alfredfrancis / requirements.txt
Last active Jun 4, 2018
Wrapper for Rasa NLU Starspace classifier written in Tensorflow. Based on the starspace idea from:
View requirements.txt
urigoren /
Last active Oct 11, 2021
LSTM Binary classification with Keras
from keras.layers import Dense, Dropout, LSTM, Embedding
from keras.preprocessing.sequence import pad_sequences
from keras.models import Sequential
import pandas as pd
import numpy as np
input_file = 'input.csv'
def load_data(test_split = 0.2):
print ('Loading data...')
nateinaction / react-firebase-auth.js
Last active Jun 16, 2019
This is a version of Facebook's React Conditional Rendering example modified to support firebase authentication.
View react-firebase-auth.js
* 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) {
EncodeTS / keras VGG-Face
Last active Jun 30, 2021
VGG-Face model for keras
View keras VGG-Face

VGG-Face model for Keras

This is the Keras model of VGG-Face.

It has been obtained through the following method:

  • vgg-face-keras:directly convert the vgg-face matconvnet model to keras model
  • vgg-face-keras-fc:first convert vgg-face caffe model to mxnet model,and then convert it to keras model

Details about the network architecture can be found in the following paper:

#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"
hnykda /
Last active Aug 21, 2020
Predicting sequences of vectors (regression) in Keras using RNN - LSTM (
import pandas as pd
from random import random
flow = (list(range(1,10,1)) + list(range(10,1,-1)))*100
pdata = pd.DataFrame({"a":flow, "b":flow})
pdata.b = pdata.b.shift(9)
data = pdata.iloc[10:] * random() # some noise
import numpy as np
mattupstate /
Created Feb 5, 2015
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)
dennisdegryse / Router.php
Created Dec 5, 2014
Basic URI router concept
View Router.php
class Router {
private $_defaultParameters;
public Router($defaultParameters) {
$this->_defaultParameters = $defaultParameters;
public function route($uri) {
guyc /
Created May 12, 2013
Test code for capacitive switch on raspberry pi.
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: