Skip to content

Instantly share code, notes, and snippets.

View alfredfrancis's full-sized avatar
🎯
Focusing

Alfred Francis alfredfrancis

🎯
Focusing
View GitHub Profile
@alfredfrancis
alfredfrancis / superviosrd.conf
Created May 18, 2018 17:10
Sample Supervisord conf to start flask app
[program:mlmodule]
command = /root/anaconda2/bin/gunicorn launcher:app -w 4 -b 0.0.0.0:6666
directory = /datavolume/manuels_module
user = root
stdout_logfile = /datavolume/manuels_module/gunicorn_stdout.log
stderr_logfile = /datavolume/manuels_module/gunicorn_stderr.log
redirect_stderr = True
@alfredfrancis
alfredfrancis / intent_classification.ipynb
Last active May 14, 2018 17:18
intent_classification.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#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"
{% if "error" in RepoOutput[RepoName.index(repo)] %}
<td id="error"> {{ RepoOutput[RepoName.index(repo)] }} </td>
{% elif "Already" in RepoOutput[RepoName.index(repo) %}
<td id="good"> {{ RepoOutput[RepoName.index(repo)] }} </td>
{% else %}
<td id="error"> {{ RepoOutput[RepoName.index(repo)] }} </td>
{% endif %}
</tr>
@alfredfrancis
alfredfrancis / unescape.js
Created February 6, 2018 07:10
Unescape JS
unescape(s){
return this.stripTags(this.s(s)).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
}
/* Starts an APK download attempt */
var MarketSession = {
/**
* Called when pressing the APK Downloader icon in the location bar.
*/
download: function(packageName, versionCode, tabId) {
BrowserStorage.get(["account", "sim"], function(items) {
if (!items.account || !items.sim) {
//alert("Please setup your device in the Options page first");
BrowserTabs.create({
@alfredfrancis
alfredfrancis / scrape_google.py
Last active November 27, 2017 12:15
scrape google
import scrapy
import re
class QuotesSpider(scrapy.Spider):
name = "microsoft"
custom_settings = {
# specifies exported fields and order
'FEED_EXPORT_FIELDS': ["url"],
}
f = open("input/test1.txt")
@alfredfrancis
alfredfrancis / nagios_iot_rpi.py
Created September 9, 2017 09:59
Nagios + IOT + Raspberry Pi
import requests
import re
from requests.auth import HTTPBasicAuth
import time
import pyttsx
engine = pyttsx.init()
REFRESH_INTERVAL = 5
@alfredfrancis
alfredfrancis / weka.java
Created August 30, 2017 12:41
weka_dataset_creation.java
import weka.classifiers.Evaluation;
import weka.classifiers.bayes.NaiveBayes;
import weka.core.Instances;
import weka.core.Instance;
import weka.core.converters.ConverterUtils.DataSource;
import weka.core.Attribute;
import weka.core.DenseInstance;
import java.io.File;
import java.io.BufferedReader;
[{"cn":"Israel","cyn":"New Israeli Sheqel","ccc":"ILS"},{"cn":"Afghanistan","cyn":"Afghani","ccc":"AFN"},{"cn":"Albania","cyn":"Lek","ccc":"ALL"},{"cn":"Algeria","cyn":"Algerian Dinar","ccc":"DZD"},{"cn":"AmericanSamoa","cyn":"US Dollar","ccc":"USD"},{"cn":"Andorra","cyn":"Euro","ccc":"EUR"},{"cn":"Angola","cyn":"Kwanza","ccc":"AOA"},{"cn":"Anguilla","cyn":"East Caribbean Dollar","ccc":"XCD"},{"cn":"Antigua and Barbuda","cyn":"East Caribbean Dollar","ccc":"XCD"},{"cn":"Argentina","cyn":"Argentine Peso","ccc":"ARS"},{"cn":"Armenia","cyn":"Armenian Dram","ccc":"AMD"},{"cn":"Aruba","cyn":"Aruban Florin","ccc":"AWG"},{"cn":"Australia","cyn":"Australian Dollar","ccc":"AUD"},{"cn":"Austria","cyn":"Euro","ccc":"EUR"},{"cn":"Azerbaijan","cyn":"Azerbaijanian Manat","ccc":"AZN"},{"cn":"Bahamas","cyn":"Bahamian Dollar","ccc":"BSD"},{"cn":"Bahrain","cyn":"Bahraini Dinar","ccc":"BHD"},{"cn":"Bangladesh","cyn":"Taka","ccc":"BDT"},{"cn":"Barbados","cyn":"Barbados Dollar","ccc":"BBD"},{"cn":"Belarus","ccc":"BYR"},{"cn":"Belg