Skip to content

Instantly share code, notes, and snippets.

View jeshuamaxey's full-sized avatar

Jeshua Maxey jeshuamaxey

View GitHub Profile
@jeshuamaxey
jeshuamaxey / gimme-sweet-emojis.js
Created February 25, 2021 16:14
Converts arbitrary string into slack-compatible emoji letters
const gimmeSweetEmojis = (input) => {
let output = "";
input
.split("")
.map(l => l.toLowerCase())
.forEach(letter => {
if (letter.match(/[a-z]/i)) output += `:alphabet-yellow-${letter}: `
else output += letter;
})
return output

Keybase proof

I hereby claim:

  • I am jeshuamaxey on github.
  • I am jeshua (https://keybase.io/jeshua) on keybase.
  • I have a public key ASDIKFkHC4j2qKCdAd_3QYHIMhKPjwzIgsTWDpknYNEkPAo

To claim this, I am signing this object:

{
"recipient":"postmaster@MY_SANDBOX_DOMAN.mailgun.org",
"sender":"jeshua@cytora.com",
"subject":"Risk Score Request",
"from":"Jeshua Maxey <jeshua@cytora.com>",
"X-Mailgun-Incoming":"Yes",
"X-Envelope-From":"<jeshua@cytora.com>",
"Received":[
"STUFF THAT INCLUDES DOMAINS THAT I'M NOT SURE ARE SECRET BUT AREN'T IMPORTANT"
],
{
"id": "hashy-stuff",
"result": {
"riskScores": {
"value": "something between A-F",
"createTime": timestamp,
"components": [
{
"value": "something between A-F",
"type": "property_risk_score",
let utils = {}
utils.extractAddressesFromEmail = function(msg) {
const lines = msg.split('\r\n');
var inAddressList = false;
var addresses = [];
for (var i = 0; i < lines.length; i++) {
if(lines[i] === 'START ADDRESSES') {
inAddressList = true;
START ADDRESSES
71 central street London
9 dallington street London
62C Fenwick road, Glasgow
END ADDRESSES
const express = require('express');
const bodyParser = require('body-parser');
const morgan = require('morgan')
const cloudFunctions = require('./cloud-functions');
const PORT = 3000;
const app = express();
@jeshuamaxey
jeshuamaxey / prepare_sentence_golds.py
Created March 10, 2016 16:07
Expects a documents gold data file to exist. Breaks the content of the document gold data into sentences and save them to a csv file.
import csv
from textblob import TextBlob
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
INFILE_NAME = r"absolute/path/to/text-labelling/text-labelling/cf_files/explosion: document_gold.csv"
OUTFILE_NAME = r"absolute/path/to/text-labelling/text-labelling/cf_files/explosion: sentence_gold.csv"
@jeshuamaxey
jeshuamaxey / get_articles_from_url.py
Last active March 10, 2016 16:03
Expects a file `urls.csv` to be a list of URLs separated by new lines. For each URL it scrapes the article content and saves it to `gold_data.csv` all scraped data over 300 chars long.
import csv
from httplib import BadStatusLine
from newspaper import Article
import requests
INFILE_NAME = "urls.csv"
OUTFILE_NAME = "gold_data.csv"
def get_sample_from_url(url):
@jeshuamaxey
jeshuamaxey / float-to-color.js
Last active November 23, 2015 23:16
takes a value from 0-1 and returns an rgb color string
/**
* takes a value from 0-1 and returns an rgb color string
*/
function floatToColor(val) {
var c = Math.floor(5*255*val);
var r = 255, g = 255, b = 255;
while(c > 0) {
if(r!=0 && g==255 && b==255) r--; //rgb(255,255,255) -> rgb(0,255,255)
if(r==0 && g==255 && b!=0) b--; //rgb(0,255,0) -> rgb(0,255,0)
if(r!=255 && g==255 && b==0) r++; //rgb(0,255,0) -> rgb(255,255,0)