Skip to content

Instantly share code, notes, and snippets.

View johnrnelson's full-sized avatar
🏠
Working from home

John Nelson johnrnelson

🏠
Working from home
View GitHub Profile
@itszn
itszn / exploit.js
Created July 11, 2018 16:27
Exploit for JavascriptCore CVE-2018-4192
// Load Int library, thanks saelo!
load('util.js');
load('int64.js');
// Helpers to convert from float to in a few random places
var conva = new ArrayBuffer(8);
var convf = new Float64Array(conva);
var convi = new Uint32Array(conva);
var convi8 = new Uint8Array(conva);
@f1sherman
f1sherman / forwarding-example.md
Last active March 12, 2021 00:21
Port Forwarding Example in OS X El Capitan

Add the following to /etc/pf.anchors/myname:

rdr pass on lo0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 4000
rdr pass on lo0 inet proto tcp from any to any port 443 -> 127.0.0.1 port 4001

Add the following to /etc/pf-myname.conf:

rdr-anchor "forwarding"
load anchor "forwarding" from "/etc/pf.anchors/myname"

This problem aims to find the accuracy of an appliance detection algorithm

Setup:

We are given whole home energy data and a truth set of appliances defined by their wattage in Kilo Watts (kW)

Example:

A home has a fridge (200W), an electric vehicle (1500W) and a dryer (5000W) -->

truth set: [ 0.2, 5.0, 1.5 ]
@jpnelson
jpnelson / split.css
Last active June 14, 2022 16:51
Responsive, resizable panel layout with flexbox
.container {
height: 500px;
border: 2px solid grey;
position:relative;
}
.split {
display: flex;
height: 100%;
border: 1px solid black;
@RichLogan
RichLogan / usStates_option_bootstrap
Last active February 4, 2024 07:09
US states dropdown for horizontal form w/ Bootstrap 3
<div class="form-group">
<label for="state" class="col-sm-2 control-label">State</label>
<div class="col-sm-10">
<select class="form-control" id="state" name="state">
<option value="">N/A</option>
<option value="AK">Alaska</option>
<option value="AL">Alabama</option>
<option value="AR">Arkansas</option>
<option value="AZ">Arizona</option>
<option value="CA">California</option>
@simenbrekken
simenbrekken / export.gs
Created October 24, 2012 21:17
Export Google Spreadsheet as JSON
function exportJSON() {
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
var result = sheets.reduce(function(result, sheet) {
var id = sheet.getName().toLowerCase();
var data = sheet.getDataRange();
var values = data.getValues();
result[id] = values.map(function(row) {
return row.map(function(column) {
return Math.round(column) || column;
@BusinessWebsiteCenter
BusinessWebsiteCenter / normalize.css
Created October 24, 2012 21:15 — forked from lightyrs/normalize.css
CSS: Normalize CSS
/* =============================================================================
HTML5 element display
========================================================================== */
/*
* Add display for block-level HTML5 elements
* Addresses display not defined in IE6/7/8/9 & FF3
*/
article,
@donnelg
donnelg / gist:3805295
Created September 29, 2012 22:09 — forked from padolsey/gist:527683
Javascript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}