This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
networksetup -listpreferredwirelessnetworks en0 | tail -n +2 | awk '{$1=$1};1' > ./wifi-networks-all.txt | |
cp ./wifi-networks-all.txt ./wifi-networks-keep.txt | |
# ... manually remove networks we DON'T want from wifi-networks-keep.txt ... | |
grep -Fvxf ./wifi-networks-keep.txt ./wifi-networks-all.txt > ./wifi-networks-remove.txt | |
networksetup -listallhardwareports | |
# ^ find wifi - probably `en0` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'net/http' | |
require 'json' | |
# Periodically check the vote tallies in CA-10 | |
# (Nov 2018 midterms, Jash Harder vs Jeff Denham) | |
class CA10Checker | |
URL = 'https://api.sos.ca.gov/returns/us-rep/district/10' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<!-- | |
Flickr slideshow code generator. | |
Created by Ben Buckman, August 2014. Open source under MIT license. | |
--> | |
<html> | |
<head> | |
<title>Flickr Slideshow Generator</title> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this catches the error (good) but still crashes (bad) | |
// was process.uncaughtException already deprecated? | |
// (shouldn't have been yet - http://nodejs.org/api/process.html#process_event_uncaughtexception) | |
process.on('uncaughtException', function(error) { | |
return console.error("CAUGHT uncaughtException", error); | |
}); | |
throw new Error("A big error!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ = require 'lodash' | |
class CrazyParentView | |
events: | |
'mousedown .thing': -> | |
class CrazyChildView extends CrazyParentView | |
constructor: -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# concept from http://stackoverflow.com/a/3403786/267224 | |
############# | |
# log to file | |
LOGFILE=/home/user/log/script.log | |
exec > >(tee -a $LOGFILE) | |
exec 2>&1 | |
############ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using test hash test-sentinel-662038 | |
sentinel client [no role] [no port] got 'end' { '0': undefined, '1': undefined, '2': undefined, '3': undefined } | |
sentinel client [no role] [no port] got 'connect' {} | |
sentinel client master 5379 got 'ready' {} | |
---- knock 1 ---- | |
1 Set? true | |
1 check integrity: all good | |
---- knock 2 ---- | |
2 Set? true | |
2 check integrity: all good |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Client(){ | |
this.subClient = new SubClient(); | |
}; | |
function SubClient(){ | |
this.numConnections = 0; | |
this.status = 'OK'; | |
}; | |
// getting error, | |
// TypeError: Invalid property. A property cannot both have accessors and be writable or have a value, #<Object> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// is it possible to hold a reference to a wrapper's object, | |
// such that the reference automatically updates when the object updates? | |
// (rather than staying with the original object)? | |
var assert = require('assert'); | |
function Wrapper(){ | |
this.client = null; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dict = ['hello', 'kitty', 'farm'] | |
isWordInDict = (word)-> | |
(dict.indexOf(word) > -1) | |
findAllWords = (str)-> | |
words = [] | |
for startInd in [0..(str.length - 1)] | |
for endInd in [(startInd + 1)..str.length] |
NewerOlder