Skip to content

Instantly share code, notes, and snippets.

View jkeefe's full-sized avatar

John Keefe jkeefe

View GitHub Profile
@jkeefe
jkeefe / date-to-eastern.js
Last active May 12, 2023 19:50
Parse current date to U.S. Eastern time + customize short months & a.m./p.m.
// installation:
// npm install dayjs dayjs-plugin-utc --save
// note: if not already a module, in package.json add "type":"module",
import dayjs from 'dayjs';
import updateLocale from 'dayjs/plugin/updateLocale.js';
import utc from 'dayjs/plugin/utc.js';
import timezone from 'dayjs/plugin/timezone.js';
// set up the as-of date
@jkeefe
jkeefe / .eslintrc
Last active May 11, 2021 14:54
My current .eslint file
{
"env": {
"browser": false,
"node": true,
"es6": true,
"mocha": false
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 8,
export EDITOR=pico
# JK Abbreviated prompt
PROMPT='%1~ ∴ '
## Direct pipenv to build dependencies right in the project
## folder under .venv
export PIPENV_VENV_IN_PROJECT=1
@jkeefe
jkeefe / .eslintrc.js
Created January 27, 2021 23:33 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@jkeefe
jkeefe / remove_exif.md
Created October 14, 2020 23:36
Remove EXIF from images with imagemagick

Removing EXIF

Using Imagemagick:

cd into the directory with lots of images

mogrify -strip ./*.jpg
@jkeefe
jkeefe / class_06_block_8.html
Last active October 13, 2021 23:10
Block 8 code for D&D Class 06
<html lang="en">
<head>
<title>Newmark Bark</title>
<meta name="description" content="latest news">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- import the webpage's stylesheet -->
@jkeefe
jkeefe / lambda.js
Created June 17, 2020 17:11
Code that actually works as a bridge between Twilio & Dialogflow on AWS Lambda
// 1. This uses claudiajs & its API Gateway to deploy to lambda & handle api post
// 2. Assumes an existing dialogflow project, google cloud project, and google cloud billing
// 3. Got credentials .json file using steps 1-5 (ONLY) here:
// https://cloud.google.com/docs/authentication/getting-started
// 4. Put that json file in a directory called "sekrets' which I added to .gitignore
// 5. Other helpful options for Google authentication are here:
@jkeefe
jkeefe / fish_tank.ino
Created March 22, 2020 21:18
Fish tank code (see johnkeefe.net)
#include <Adafruit_NeoPixel.h>
#define PIN1 6
#define PIN2 3
#define NUM_LEDS 60
#define BRIGHTNESS 250
int blue_every = 12; // make every Xth pixel blue
@jkeefe
jkeefe / sratch.py
Created March 20, 2020 02:56
pymysql connection setup
import pandas as pd
import pymysql
host="very.long.endpoint.definition.amazonaws.com"
port=3306
dbname="your_database_name"
user="your_user_name"
password="your_password"
conn = pymysql.connect(host, user=user,port=port,
@jkeefe
jkeefe / feature_importance.py
Last active June 24, 2019 02:02
Fast.ai feature importance function for neural nets
# Originally shared by Zachary Mueller here:
# https://forums.fast.ai/t/feature-importance-in-deep-learning/42026/16
# ... which he adapted from Miguel Mota Pinto's post here:
# https://medium.com/@mp.music93/neural-networks-feature-importance-with-fastai-5c393cf65815
# Assumes all necessary fast.ai v1.0 libraries are loaded
def feature_importance(learner):
# based on: https://medium.com/@mp.music93/neural-networks-feature-importance-with-fastai-5c393cf65815
data = learner.data.train_ds.x