echo 1 | sudo tee /sys/class/backlight/intel_backlight/brightness
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
sudo apt install qrencode | |
printf "Hello world" | qrencode -t utf8 |
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
#!/usr/bin/env zx | |
const x = | |
await $`echo | openssl s_client -servername bdadam.com -connect "bdadam.com:443" 2>/dev/null | openssl x509 -noout -enddate | cut -d= -f2`; | |
const diff = new Date(x.stdout).getTime() - Date.now(); | |
console.log(diff); | |
console.log(diff > 30 * 24 * 60 * 60 * 1000); |
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
// https://stackoverflow.com/questions/48719873/how-to-get-median-and-quartiles-percentiles-of-an-array-in-javascript-or-php | |
// sort array ascending | |
const asc = arr => arr.sort((a, b) => a - b); | |
const sum = arr => arr.reduce((a, b) => a + b, 0); | |
const mean = arr => sum(arr) / arr.length; | |
// sample standard deviation |
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
// createCache.ts | |
export default function createCache(fetchFunction: () => Promise<any>, refreshInterval: number, retryAfter: number) { | |
let fetchPromise: null | ReturnType<typeof fetchFunction> = null; | |
const doThinInInterval = () => { | |
fetchFunction().then((data) => { | |
fetchPromise = Promise.resolve(data); | |
}) | |
.catch(() => setTimeout(doThinInInterval, retryAfter)); | |
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
// https://leetcode.com/problems/lru-cache/submissions/ | |
class LRUCache { | |
obj: Record<number, { val: number; acc: number }>; | |
capacity: number; | |
size: number; | |
acc: number; | |
cache: Record<number, [val: number, acc: number, key: number]>; | |
c: Map<number, [val: number, acc: number]> |
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 interpolate from './interpolate'; | |
describe('Interpolate for Translations', () => { | |
// eslint-disable-next-line jest/no-commented-out-tests | |
// it('blah', () => { | |
// expect(interpolate('asdf')).toEqual('asdf'); | |
// expect(interpolate('Hello {0}', ['World!'])).toEqual('Hello World!'); | |
// expect(interpolate('Hello {0} {0}', ['World!'])).toEqual('Hello World! World!'); | |
// expect(interpolate('Hello {0} {1} {2}!', ['World!', 'Welcome', 'here'])).toEqual('Hello World! Welcome here!'); | |
// expect(interpolate('Hello {0} {1} {2}! {1} {2}!', ['World!', 'Welcome', 'here'])).toEqual( |
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
# https://android.stackexchange.com/a/199496 | |
adb forward tcp:9222 localabstract:chrome_devtools_remote | |
wget -O tabs.json http://localhost:9222/json/list |
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 Programming Jargon in simple terms: | |
https://github.com/hemanth/functional-programming-jargon | |
Professor Frisby's Mostly Adequate Guide to Functional Programming (book): | |
https://drboolean.gitbooks.io/mostly-adequate-guide/content/ | |
A series on FP in JS from Eric Elliott: | |
https://medium.com/javascript-scene/the-rise-and-fall-and-rise-of-functional-programming-composable-software-c2d91b424c8c | |
Some introduction to Monads: |
NewerOlder