Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Alfred Francis alfredfrancis

🏠
Working from home
View GitHub Profile
View who.py
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import Pipeline
from NLTKPreprocessor import NLTKPreprocessor
import os
import json
PATH = "new.model"
model = Pipeline([
View personal.json
[
{
"text": "How would you describe yourself?",
"intentName": "personal-bio"
},
{
"text": "When is your birthday?",
"intentName": "personal-birthday"
},
{
View random_colors.js
var colors = {
1:"#ff1123",
2:"#000000",
3:"#010101"
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
@alfredfrancis
alfredfrancis / react-firebase-auth.js
Created Jan 30, 2017 — forked from nateinaction/react-firebase-auth.js
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) {
View python_udp_log_handler.py
import logging
import logging.handlers
import time
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(levelname)-8s %(message)s')
logging.getLogger().addHandler(logging.handlers.DatagramHandler('localhost', 8045))
while True:
View python_mongodb_insert_json.py
import pymongo
import sys
connection = pymongo.Connection("mongodb://localhost", safe=True)
db=connection.nooora
coll = db.nooracollection
@alfredfrancis
alfredfrancis / people.txt
Last active Apr 14, 2017
Spark sql example
View people.txt
Michael, 29
Andy, 30
Justin, 19
Arun, 20
Alfred, 22
View pdfWaterMark.vb
Imports iTextSharp.text.pdf
Imports iTextSharp.text
Imports System.IO
Imports iTextSharp.text.io
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System
Imports System.Collections.Generic
Imports System.Windows.Forms
@alfredfrancis
alfredfrancis / currency_code_vs_currency_name.json
Created Apr 20, 2017
JSON of common currency codes vs Currency names
View currency_code_vs_currency_name.json
[
{
"currencycode": "Afghani",
"code": "AFN"
},
{
"currencycode": "Euro",
"code": "EUR"
},
{
@alfredfrancis
alfredfrancis / example.py
Created Apr 21, 2017 — forked from mattupstate/example.py
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)