Skip to content

Instantly share code, notes, and snippets.

View mhkeller's full-sized avatar

Michael Keller mhkeller

View GitHub Profile
@mhkeller
mhkeller / package.json
Last active March 26, 2024 18:09
Convert a parquet file to bytes representing an arrow table
{
"name": "parquet-to-arrow",
"version": "1.0.0",
"description": "",
"scripts": {
},
"dependencies": {
"apache-arrow": "^15.0.2",
"arrow-js-ffi": "^0.4.1",
"parquet-wasm": "^0.6.0-beta.2"
@mhkeller
mhkeller / endpoint.txt
Last active January 9, 2023 18:47
Google "I'm Feeling Lucky" Endpoint
http://www.google.com/search?hl=en&btnI=I%27m+Feeling+Lucky&pws=0&q=<ENTER SEARCH TERM HERE>
@mhkeller
mhkeller / concat.bash
Created October 22, 2018 15:09
Concatenate csv files
# Adapted from https://unix.stackexchange.com/questions/60577/concatenate-multiple-files-with-same-header#170692
# `head -1` gets first line of the file of the file and stashes them as the header row into `all.txt`
# `tail -n +2 -q *.csv >> all.txt` grabs every csv file from the second row down and stashes them into `all.txt`
# `all.txt` is a csv file but we use the txt extension to avoid it being captured in the `*.csv` glob.
# You could also output to a csv file by having your input files share a naming convention such as `file-001.csv` and glob on `file*.csv`
# But renaming `all.txt` to `all.csv` is sometimes easier than worrying about a naming convention and txt and csvs are the same thing
head -1 my-csv-01.csv > all.txt; tail -n +2 -q *.csv >> all.txt
const { Pool, Client } = require('pg');
const namespaceQuery = `SELECT nspname
FROM pg_namespace
WHERE oid = pg_my_temp_schema();`;
const fnQuery = `CREATE OR REPLACE FUNCTION pg_temp.increment(i integer)
RETURNS integer
LANGUAGE plpgsql
AS $function$
@mhkeller
mhkeller / README.md
Last active April 15, 2022 19:54
HTML, CSS and JavaScript tutorials

HTML, CSS and JavaScript tutorials

Here's a collection of guidebooks and tutorials that give the basics of HTML, CSS and JavaScript – three languages that form the basis for the modern web. The Mozilla links are documents that you can read through. The CodeCademy and other sites are interactive tutorials to get used to writing code.

For future projects, install Visual Studio Code, which is a handy text editor, useful for more than just web development (you can take interview notes in it, for example). Also, you'll want to install XCode on your mac, which you can access via the App Store on your computer. It's a big download (around 3gb) so it takes a while.

HTML - Creating elements and text (the structure of a page)

@mhkeller
mhkeller / index.html
Last active March 17, 2022 04:05
Responsive d3 line chart
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
fill: none;
stroke: #000;
stroke-width: 10px;
}
AL, AK, AZ, AR, CA, CO, CT, DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA, WV, WI, WY
@mhkeller
mhkeller / gist:4567006
Last active January 20, 2022 02:46
Open Street Map Geocoder
// BEGIN GEOCODING
$adrsInput = $('#address-submit');
$adrsText = $('#address-text')
var geocoder,
firstRun = true,
markerGroup;
var geoCode = function(address) {
$.ajax({
url:'http://open.mapquestapi.com/geocoding/v1/address?&inFormat=kvp&outFormat=json&location='+address,
@mhkeller
mhkeller / inject-css.js
Last active December 6, 2021 04:57
Bookmarklet for injecting new css
javascript: (function() {
var newcss = `PUT NEW CSS HERE`;
var tag = document.createElement("style");
tag.type = "text/css";
document.getElementsByTagName("head")[0].appendChild(tag);
tag[(typeof document.body.style.WebkitAppearance == "string") ? "innerText" : "innerHTML"] = newcss
})();
@mhkeller
mhkeller / group.js
Last active December 3, 2021 04:19
d3-array's group and groups functions
class InternMap extends Map {
constructor(entries, key = keyof) {
super();
Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});
if (entries != null) for (const [key, value] of entries) this.set(key, value);
}
get(key) {
return super.get(intern_get(this, key));
}
has(key) {