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 / 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'))")
const table = $($('table.list')[0])
const rows = $(table.children()[0]).children()
let countRow = 0
let heading = []
let grades = []
for(let row of rows) {
let rowData = {}
let countCol = 0
topD=document.getElementsByClassName('navigation-widget-content')[0];
l=allDescendants(topD, 0);
console.log(l);
copy(l);
console.log("copied to clipboard in markdown format :)");
function allDescendants (node, levels) {
let arr=[];
if(node.childNodes)
for (var i = 0; i < node.childNodes.length; i++) {
@justinoboyle
justinoboyle / extract-strings.py
Created June 18, 2017 02:33
Finds strings in executables, useful for analyzing malware.
#!/usr/bin/env python2
# Finds strings in executables, useful for analyzing malware.
# Usage: cat <filename> | ./extract-strings
import sys
import re
chars = r"A-Za-z0-9/\-:.,_$%'()[\]<> "
shortest_run = 4
// Java has this already, don't bother :)
Array.prototype.peek = function() {
return this[this.length - 1];
}
// Cool, right?
let toClose = o => o.charCodeAt(0) == 40 ? String.fromCharCode(41) : String.fromCharCode(o.charCodeAt(0) + 2);
let toOpen = o => o.charCodeAt(0) == 41 ? String.fromCharCode(40) : String.fromCharCode(o.charCodeAt(0) - 2);
let matches = ['(', '[', '{'],
//META{"name":"StaffPortal"}*//
var StaffPortal = function () {};
StaffPortal.prototype.getName = function() {
return "StaffPortal";
};
StaffPortal.prototype.getDescription = function() {
return "Easier StaffPortal integration!";
};
@justinoboyle
justinoboyle / .babelrc
Last active January 22, 2017 00:03
Simple Node + Babel Boilerplate
{
"presets": ["es2015", "stage-0"]
}