Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Alfred Francis alfredfrancis

🏠
Working from home
View GitHub Profile
View tweets_to_db.py
"""
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 tweets_to_db.py`
"""
import tweepy
import sqlite3
import datetime
@alfredfrancis
alfredfrancis / requirements.txt
Last active Jun 4, 2018
Wrapper for Rasa NLU Starspace classifier written in Tensorflow. Based on the starspace idea from: https://arxiv.org/abs/1709.03856.
View requirements.txt
cloudpickle
tensorflow
spacy
numpy
sklearn
@urigoren
urigoren / LSTM_Binary.py
Last active Oct 11, 2021
LSTM Binary classification with Keras
View LSTM_Binary.py
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
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.
* https://facebook.github.io/react/docs/conditional-rendering.html
*/
import React, { Component, PropTypes } from 'react';
import * as firebase from 'firebase';
function UserAvatar(props) {
@EncodeTS
EncodeTS / keras VGG-Face Model.md
Last active Jun 30, 2021
VGG-Face model for keras
View keras VGG-Face Model.md

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:

View deployment.py
#Original Author https://raw.githubusercontent.com/kgoedecke/python-ecs-example/master/python_ecs_example/deployment.py
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
hnykda / keras_prediction.py
Last active Aug 21, 2020
Predicting sequences of vectors (regression) in Keras using RNN - LSTM (danielhnyk.cz)
View keras_prediction.py
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
mattupstate / example.py
Created Feb 5, 2015
JSON Patch SQLAlchemy models w/ Flask
View example.py
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)
make_class_dictable(db.Model)
@dennisdegryse
dennisdegryse / Router.php
Created Dec 5, 2014
Basic URI router concept
View Router.php
<?php
class Router {
private $_defaultParameters;
public Router($defaultParameters) {
$this->_defaultParameters = $defaultParameters;
}
public function route($uri) {
@guyc
guyc / capswitch.py
Created May 12, 2013
Test code for capacitive switch on raspberry pi.
View capswitch.py
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: https://github.com/WiringPi/WiringPi-Python
# pins: https://projects.drogon.net/raspberry-pi/wiringpi/pins/