Skip to content

Instantly share code, notes, and snippets.

View drbh's full-sized avatar
🕳️
a for AI

drbh drbh

🕳️
a for AI
  • drbh
  • state space
  • 03:29 (UTC -04:00)
View GitHub Profile
@drbh
drbh / explore.ipynb
Created January 3, 2020 00:40
Create some fake person spending data and get weekly and monthly summaries in a notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@drbh
drbh / app.ipynb
Created December 11, 2019 02:51
Checking out the VIX performance by comparing weekly changes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@drbh
drbh / using-bert-score-for-chatbots.ipynb
Created December 5, 2019 15:10
A simple way to use BERTScore to find the best FAQ response
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@drbh
drbh / phoenix_gov_faq.csv
Created November 21, 2019 03:34
Scraped - parsed and saved city of phoenix's FAQ as CSV
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
,question,answer
0,Is there a charge for a verifier to obtain the verification of an employee's employment information?,"Verifiers pay a fee directly to the Work Number for employment verifications. City of Phoenix employees should not ever have to pay a fee. If you believe you have been charged a fee by a lender or other requestor for the verification of your employment, please contact Human Resources at 602-262-6608 or via e-mail at hrcenter@phoenix.gov. The vendor - The Work Number - does not charge the City a fee for providing this service."
1,What security measures are in place to protect my personal information?,"The database system that stores employees' personal data is isolated from the Internet with firewall technology and personal data is not stored on the Web server. Transactions conducted using the Web application are encrypted; security patches are installed as well. You can find more information about the security of The Work Number by logging onto their website, www.theworknumber.com."
2,"Afte
@drbh
drbh / phoenix_gov_faq.py
Created November 21, 2019 02:07
Scrape - parse and save the city of phoenix's FAQ questions to a CSV
from bs4 import BeautifulSoup
import requests
import pandas as pd
# function to remove non-ASCII
def remove_non_ascii(text):
return ''.join(i for i in text if ord(i)<128)
def extract_question_text(s):
html_tree = BeautifulSoup(s, "lxml").find("div")
@drbh
drbh / mutex_pool.rs
Created October 28, 2019 15:38
A simple mutex POOL for a custom obj. Useful for templating data storage connector polls in a multi threaded way
#![feature(drop_types_in_const)]
use std::sync::{Mutex, MutexGuard};
#[macro_use]
extern crate lazy_static;
lazy_static! {
static ref POOL: Mutex<Vec<Obj>> = Mutex::new(vec![]);
}
@drbh
drbh / smallest-flask.py
Created October 10, 2019 18:29
A snippet i'm always looking for and cant find - just the smallest possible flask server
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return "Hello World!"
if __name__ == '__main__':
app.run()
@drbh
drbh / inline-b64-wasm-flate-inline-loadin.js
Created October 10, 2019 15:21
Loading in wasm-flate wasm as a base64 string! < 240 KBs - not minified or optimized for size.
// https://www.npmjs.com/package/base64-arraybuffer
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
// Use a lookup table to find the index.
const lookup = new Uint8Array(256);
for (let i = 0; i < chars.length; i++) {
lookup[chars.charCodeAt(i)] = i;
}
function decode(base64) {
@drbh
drbh / querying_postgres_from_python.py
Created October 1, 2019 16:59
A simple example of querying Postgres from Python assuming the DB is hosted on a AWS workspace and is password protected.
from sqlalchemy import create_engine
import pandas as pd
engine = create_engine(
'postgresql://postgres:YOURPASSWORDHERE@*.*.*.*.us-west-2.compute.amazonaws.com:5432/postgres')
frame = pd.read_sql('SELECT * FROM my_table LIMIT 10', engine)
@drbh
drbh / wasm-flate-web-worker.js
Last active August 21, 2019 04:04
An inline web worker example of wasm-flate 🙌compress files using WASM on a separate thread!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<input type="button" value="Test" onclick="OnClickTest();" />
<script id="scriptWorker" type="javascript/worker">