Skip to content

Instantly share code, notes, and snippets.

View ocken012's full-sized avatar

Alexander Ockenden ocken012

View GitHub Profile
@ocken012
ocken012 / fillForward.js
Created September 30, 2018 03:05
Javascript function to forward-fill HTML input boxes of same class.
function fillForward(bx) {
var cbs = document.getElementsByClassName(bx.className);
for(var i=1; i < cbs.length; i++) {
if (i == 1) {
var filler = cbs[i].value;
}
else {
cbs[i].value = filler;
}
}
@ocken012
ocken012 / cryptoVisualizer.py
Last active October 1, 2018 02:46
Python script to query SQLite database, process and visualize cryptocurrency data.
import sqlite3 # Import Python's sqlite package
import pandas as pd # Import pandas
from datetime import datetime # Import python's datetime packages
import seaborn as sns # Import pretty bar chart package
from matplotlib import pyplot as plt
sns.set(style = "whitegrid", rc = {'figure.figsize': (10, 10)})
# Establish a connection to the sqlite database file
cnx = sqlite3.connect('C:/Users/aockenden/Desktop/test.db')
@ocken012
ocken012 / cryptoScraper.py
Created October 1, 2018 02:45
Python script to scrape cryptocurrency data from website, and dump to CSV.
import urllib2 #Import Python's url-fetching library
import re #Import Python's regular expressions library (string matching)
import pandas as pd #Import Python's data-structure library (matrices, vectorized math etc.)
import win32com.client as win32
from datetime import datetime #Import Python's datetime library
hdr = {'User-Agent':'Mozilla/5.0'} #Create request header
@ocken012
ocken012 / dataEntryApp.py
Created October 1, 2018 03:21
Python web-app which allows provides structured data entry into back-end SQL tables.
from bottle import Bottle, request, redirect, template, BaseRequest
from exchangelib import DELEGATE, Account, Credentials, Message, Mailbox, HTMLBody
from datetime import datetime
import dbUtils as db
import pandas as pd
import os, configparser
import userDictFuncs as udf
app = Bottle()
@ocken012
ocken012 / evolutionarySimulation.py
Last active October 20, 2018 23:56
Python agent-based simulation of two-dimensional creatures that evolve through time.
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 03 10:34:20 2018
@author: aockenden
"""
import random
from matplotlib import pyplot as plt
import pandas as pd