This file contains hidden or 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
export interface IModuleImport { | |
(authOptions?: IAuthOptions): IGCloud; | |
} | |
export interface IAuthOptions { | |
projectId?: string; | |
keyFilename?: string; | |
} |
This file contains hidden or 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
/*jshint esversion: 6 */ | |
const ps = [0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4]; // these are the p vals that will be tested | |
const numHosts = 3; // change this to vary the number of hosts | |
// change this to vary the maximum number of messages a host might want to send | |
// unsigned 16-bit int | |
const maxMessageCount = 10; | |
// number of times to repeat the simulation for given p, numHosts and maxMessageCount |
This file contains hidden or 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
const fs = require('fs'); | |
const fileName = '01-net.cap'; | |
const targetIPAddress = '192.168.0.101'; | |
const result = {}; | |
let totalBytesRead = 0; | |
const readRawBytes = (numBytes, fd) =>{ | |
const start = totalBytesRead; |
This file contains hidden or 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
// functional instatiation | |
var FunctionalCat = function(name){ | |
var result = {}; | |
result.name = name; | |
result.sayHi = function(){ | |
console.log(`Meow, my name is ${this.name}, the cat.`); | |
} | |
return result; | |
}; |
This file contains hidden or 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
import UIKit | |
class LoggingViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
print("viewDidLoad") | |
} | |
override func viewWillAppear(_ animated: Bool) { |
This file contains hidden or 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
xcodebuild -alltargets clean | |
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" | |
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" | |
rm -rf ~/Library/Developer/Xcode/DerivedData/* | |
rm -rf ~/Library/Caches/com.apple.dt.Xcode/* |
This file contains hidden or 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
# On remote, install and start tinyProxy | |
# Note: By default, tinyproxy listens on port 8888 and only accepts local connections | |
sudo apt-get install tinyproxy | |
# On local, | |
ssh -L 3128:localhost:8888 -i ~/.ssh/some-private-key.pem ubuntu@your-remote-machine-ip -N | |
# Then configure your OS's proxy settings to use localhost:3128 | |
# Notes |
This file contains hidden or 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
var minDominoRotations = function(A, B) { | |
const minRotationsToSetAllTo = (x) => { | |
let aSame = 0; | |
let bSame = 0; | |
for(let i=0; i<A.length; i++){ | |
if(A[i] !== x){ | |
if(B[i] === x) aSame++; | |
else aSame = Infinity; | |
} |
This file contains hidden or 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
var numDecodings = function(s) { | |
const memo = new Array(s.length).fill(null); // for performance | |
const inner = (i) => { | |
// base cases | |
if(i === s.length) return 1; // if we make it to the end, we've completed a valid decoding | |
if(s[i] === '0') return 0; // no decoding can have a leading 0 | |
if(memo[i] !== null) return memo[i]; // for performance |
This file contains hidden or 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
// 'Pure' recursive | |
// Note that this is almost literally just writing out the question statement | |
var uniquePaths = function(m, n) { | |
// also note this is a pure function: No side effects. No enclosed local vars | |
// Using an inner function just to keep things tidy and not pass (m, n) everywhere | |
const traverse = (i, j) => { // i, j are position on board | |
if(i === m-1 && j === n-1) return 1; // Count the number of ways the robot gets here. | |
// I.e., every time the robot gets here, return 1. |
OlderNewer