def fn1(n):
"""Linear."""
return 1 if n <= 0 else 1 + fn1(n-1)def fn2(n): """Linear."""
| def find_max_subarray(arr): | |
| min_sum = max_sum = 0 | |
| for running_sum in itertools.accumulate(arr): | |
| min_sum = min(min_sum, running_sum) | |
| max_sum = max(max_sum, running_sum - min_sum) | |
| return max_sum |
| #!/bin/bash | |
| set -eu | |
| # This should likely be the "baseline" of what's currently been recorded | |
| # from master | |
| export PREVIOUS_SHA=$(git rev-parse origin/master) | |
| # This should likely be the newly introduced commit | |
| export CURRENT_SHA="$(git rev-parse HEAD)" |
| # matrix | |
| matrix = [ | |
| [1,2,3], | |
| [4,5,6] | |
| ] |
// treeshaking - remove all nodes at height 3 if they're leaves
*
/ | \
* * *
/ \
* *
/ \
* *using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
| { | |
| "name": "piper.im", | |
| "version": "2.0.0", | |
| "description": "Personal website of Piper Chester", | |
| "main": "index.html", | |
| "dependencies": { | |
| "react": "^16.2.0", | |
| "react-dom": "^16.2.0", | |
| "react-scripts": "1.0.17", | |
| "http-server": "^0.10.0", |
| { | |
| dependencies: { | |
| prettier, | |
| husky, | |
| lint-staged, | |
| } | |
| } |
| // hoisting sample | |
| 'use strict'; | |
| console.log(bar); // undefined | |
| var bar = 'bar'; | |
| console.log(bar); // 'bar' | |
| // function decls hoisted as well (not func expressions though) |
| uptime | |
| dmesg | tail | |
| vmstat 1 | |
| mpstat -P ALL 1 | |
| pidstat 1 | |
| iostat -xz 1 | |
| free -m | |
| sar -n DEV 1 | |
| sar -n TCP,ETCP 1 | |
| top |