Skip to content

Instantly share code, notes, and snippets.


Brett Levenson boichee

  • Facebook
  • San Francisco, CA
View GitHub Profile
boichee /
Last active Aug 1, 2019
A shell function for macOS that allows mosh-server to send/receive traffic without having to deactivate the firewall
# Mosh Server on macOS Mojave is blocked by the packet filter.
# Modifying the pf.conf for pfctl is not enough to make it work.
# The following function does, however, seem to allow the necessary
# traffic to pass through the firewall
fix_mosh_server() {  ✔  10037  13:10:10
local fw='/usr/libexec/ApplicationFirewall/socketfilterfw'
local mosh_sym="$(which mosh-server)"
local mosh_abs="$(greadlink -f $mosh_sym)"
boichee / RotatedArrayDCSeach.js
Created Sep 26, 2014
Divide and Conquer Algo for Searching a Sorted, Rotated Array
View RotatedArrayDCSeach.js
// Going to create a way to search a rotated array that uses a divide and conquer approach rather than the standard binary tree method
var maxNumber = 50000// Or use something like Math.pow(2,31) to create a large binary integer; // A 32 bit integer, since bitwise only works on 32 bit ints
function splitList(arr, sections) {
// arr = the list we're searching
// num = the number we're searching for
// sections = the number of sections to break the larger list into
var a = []; // Create a new array to hold the multiple arrays
boichee / jsfid-console-emu.css
Created Sep 13, 2014
Simple console emulator for JSFiddle - CSS Pane
View jsfid-console-emu.css
.console {
font-family: monospace;
margin: 2px;
.large {
font-size: 1.5em;
/* Define the prompt */
.console {
boichee / jsfid-console-emu.html
Created Sep 13, 2014
Simple console emulator for JSFiddle - HTML Pane
View jsfid-console-emu.html
<div class="console large">Console Emulator:</div>
<div id="console-log" class="console">
<p class="help">Just use console.log("...") as you normally would.</p>
boichee / jsfid-console-emu.js
Created Sep 13, 2014
Simple console emulator for JSFiddle
View jsfid-console-emu.js
// JS Console Emulator
console = {
log: function (text) {
console.linecount = console.linecount++ || 1;
if (console.linecount === 1) $("#console-log").empty();
$("<p/>", {
html: text