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 / LocationManager.java
Last active July 20, 2021 14:47
Spigot/Bukkit LocationManager
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@justinoboyle
justinoboyle / satoshi-bot.js
Last active December 25, 2020 23:59
Satoshi Mines Bot
// This is a modification of bitcointools.xyz's bot #2.
// This version allows autocashout.
var bet = 51; // place your bet here. minimum is 30.
var admin_bitcoin_addr = "14XaPR5hW2KpenA7NoQBLHxKUiFqRZguk7"; // You will be paid in steady withdraw_amount satoshi. (Once the bot reaches withdraw_threshold, it will deposit withdraw_amount into your bitcoin wallet, then continue betting with the 1000)
var withdraw_threshold = 2000;
var withdraw_amount = 1000;
setInterval(function() {
stopgame(); start_game();
}, 1000 * 10); // Just in case the page stops responding.
@justinoboyle
justinoboyle / 404_shrug.html
Last active October 8, 2020 22:27
404 Shrug ¯\_(ツ)_/¯
<html lang=en><meta charset=utf-8><head><title>404 Not Found</title><meta name=viewport content="width=device-width,initial-scale=1"><link href="http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300itlic,400italic,500,500italic,700,700italic,900italic,900" rel=stylesheet type=text/css><style>body{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.shrug{font-family:Roboto,sans-serif;font-size:100px}.text{font-family:Roboto,sans-serif;font-size:30px}.footer{font-family:sans-serif;font-size:20px}.center{width:450px;height:340px;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto}a:link{text-decoration:none;color:#006786}a:visited{text-decoration:none;color:#006786}a:hover{text-decoration:none;color:#006786}a:active{text-decoration:none;color:#006786}</style><body><div class=center><div class=shrug>¯\_(ツ)_/¯</div><div class=text>We couldn't find the page you were looking for.</div><br><div class=footer>
@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 }';
function pushState(e, t) {
history.pushState('', '', e);
var n = new XMLHttpRequest;
n.onreadystatechange = function() {
if (4 == n.readyState && 200 == n.status) {
for (var e = document.childNodes.length - 1; e >= 0;) document.removeChild(document.childNodes[e--]);
document.write(n.responseText), t()
}
}, n.open('GET', e, !0), n.send(null)
}
@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);