Skip to content

Instantly share code, notes, and snippets.

View alfredfrancis's full-sized avatar
🎯
Focusing

Alfred Francis alfredfrancis

🎯
Focusing
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 tweets_to_db.py`
"""
import tweepy
import sqlite3
import datetime
@alfredfrancis
alfredfrancis / requirements.txt
Last active June 4, 2018 18:56
Wrapper for Rasa NLU Starspace classifier written in Tensorflow. Based on the starspace idea from: https://arxiv.org/abs/1709.03856.
cloudpickle
tensorflow
spacy
numpy
sklearn
@urigoren
urigoren / LSTM_Binary.py
Last active June 22, 2023 19:37
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
nateinaction / react-firebase-auth.js
Last active November 21, 2022 14:44
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.
* 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 February 19, 2024 06:56
VGG-Face model for keras

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 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 August 21, 2020 01:33
Predicting sequences of vectors (regression) in Keras using RNN - LSTM (danielhnyk.cz)
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 February 5, 2015 03:37
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)
make_class_dictable(db.Model)
@dennisdegryse
dennisdegryse / Router.php
Created December 5, 2014 16:30
Basic URI router concept
<?php
class Router {
private $_defaultParameters;
public Router($defaultParameters) {
$this->_defaultParameters = $defaultParameters;
}
public function route($uri) {
@guyc
guyc / capswitch.py
Created May 12, 2013 22:37
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: https://github.com/WiringPi/WiringPi-Python
# pins: https://projects.drogon.net/raspberry-pi/wiringpi/pins/