Skip to content

Instantly share code, notes, and snippets.

View justinoboyle's full-sized avatar
Probably drinking coffee.

Justin O'Boyle justinoboyle

Probably drinking coffee.
View GitHub Profile
@justinoboyle
justinoboyle / csvToJSON.js
Last active December 9, 2021 22:40
Convert string in CSV format to JSON
// Convert string in CSV format to JSON
// Pass in a list of headers if the file doesn't have one
const csvToJSON = (csv, headers = null) => {
const lines = csv.split("\n");
const _headers = !headers ? lines[0].split(",") : headers;
const data = lines.slice(headers ? 1 : 0).map((line) => {
const values = line.split(",");
return values.reduce((obj, value, index) => {
obj[_headers[index]] = value;
return obj;
@justinoboyle
justinoboyle / gist:ad38323a77ae9fb83f4033f4fccc731c
Last active November 30, 2021 00:39
how to install erlang@22 with wxwidgets support on debian/ubuntu
for debian systems
fyi -- can usually just double click to install a package but if not, `sudo dpkg -i [path]` works too
1. update your mirrors:
`sudo apt-get update`
2. install this library that the wxwidgets depends on (weird but ubuntu LTS doesn't come with it)
@justinoboyle
justinoboyle / gnome-terminal-tab.sh
Created June 8, 2020 01:13
Enable Ctrl + Tab and Ctrl + Shift + Tab in gnome-terminal (Ubuntu)
#!/bin/bash
gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ next-tab '<Primary>Tab'
gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ prev-tab '<Primary><Shift>Tab'
@justinoboyle
justinoboyle / Google Tasks Unlocker.js
Created September 23, 2019 17:03
Google Tasks Unlocker UserScript
// ==UserScript==
// @name google tasks
// @match https://tasks.google.com/*
// @grant none
// ==/UserScript==
// Just go to tasks.google.com. Installing as a shortcut works too.
if(Object.values(document.getElementsByTagName('p')).map(a=>a.innerText).join(' ').includes('The requested URL was not found on this server. '))
window.location.href="https://tasks.google.com/embed/?origin=https://calendar.google.com&fullWidth=1"
var s = document.createElement('style');
s.textContent = 'body { display: inline !important }';
@justinoboyle
justinoboyle / error.log
Created April 19, 2019 21:22
PHP error
✘  ~  php php7cc.phar /run/user/1000/gvfs/REDACTED/wp-content/themes/AttorneyTheme/
File: /run/user/1000/gvfs/REDACTED/wp-content/themes/AttorneyTheme/inc/blog-functions.php
> Line 248: Possible internal array pointer access/modification in a by-value foreach loop
current($attachment_ids);
File: /run/user/1000/gvfs/REDACTED/wp-content/themes/AttorneyTheme/vendor/import/offline/attorney-importer.php
> Line 19: Removed function "mysql_connect" called
mysql_connect($host, $uname, $dbpass);
@justinoboyle
justinoboyle / arduino-script.js
Last active March 26, 2019 15:11
Arduino Song Code Generator - This Node.JS script takes an input file of piano notation and converts it into valid C++ code
/**
* Arduino Song Code Generator - by Justin O'Boyle
* https://github.com/justinoboyle
* justin@justinoboyle.com
*
* This Node.JS script takes an input file of piano notation (I used notation from pianoletternotes.blogspot.com) and converts it into valid C++ code.
*
* Usage:
* node arduino-script.js # Uses bars.txt as input
*
@justinoboyle
justinoboyle / nyc-neighborhoods.json
Created February 25, 2019 23:41
New York City Neighborhoods by Zip Code
{
"10012": "SoHo, Mn",
"10013": "Greenwich Village, Mn",
"10014": "West Village, Mn",
"10004": "Bowling Green, Mn",
"10005": "Financial District, Mn",
"10006": "Battery Park City, Mn",
"10007": "City Hall, Mn",
"10038": "Battery Park City, Mn",
"10002": "Lower East Side, Mn",
main() {
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
# add to .*rc
eval $(node -e "eval(new Buffer('bGV0IHsgcmVhZGRpclN5bmMgfSA9IHJlcXVpcmUoJ2ZzJyksIHsgam9pbiB9ID0gcmVxdWlyZSgncGF0aCcpOyBkaXJlY3RvcmllcyA9IFsgJy9BcHBsaWNhdGlvbnMvJywgJy9BcHBsaWNhdGlvbnMvVXRpbGl0aWVzJyBdO2RpcmVjdG9yaWVzLmZvckVhY2goZGlyID0+IHJlYWRkaXJTeW5jKGRpcikuZmlsdGVyKGEgPT4gYS5lbmRzV2l0aCgnLmFwcCcpKS5mb3JFYWNoKGZpbGUgPT4gY29uc29sZS5sb2coYFBBVEg9JFBBVEg6JHtqb2luKGRpciwgZmlsZSwgJy4vQ29udGVudHMvTWFjT1MnKS5zcGxpdCgnICcpLmpvaW4oJ1wgJyl9YCkpKQ==', 'base64').toString('ascii'))")