Technically all the commands in this section apply to screen sessions. For brevity, we refer to screen sessions as simply screens.
screen
const socketPath = "/tmp/mock-server"; | |
// Needed if starting with node --watch | |
try { | |
await Deno.remove(socketPath); | |
} catch (e) { | |
// ignore | |
} | |
let server = Deno.serve({ path: socketPath }, (_req) => new Response("Hello, world.")); |
const asyncGeneratorInstancePrototype = Object.getPrototypeOf(async function*(){}()); | |
const AsyncGeneratorPrototype = Object.getPrototypeOf(asyncGeneratorInstancePrototype); | |
let AsyncIteratorPrototype; | |
if (AsyncGeneratorPrototype === Object.prototype) { | |
// Fix-up for babel's transform-async-generator-functions | |
AsyncIteratorPrototype = {}; | |
const newAsyncGeneratorPrototype = Object.create(AsyncIteratorPrototype); | |
Object.setPrototypeOf(asyncGeneratorInstancePrototype, newAsyncGeneratorPrototype); | |
} else { | |
AsyncIteratorPrototype = Object.getPrototypeOf(AsyncGeneratorPrototype); |
const asyncGeneratorInstancePrototype = Object.getPrototypeOf(async function*(){}()); | |
const AsyncGeneratorPrototype = Object.getPrototypeOf(asyncGeneratorInstancePrototype); | |
let AsyncIteratorPrototype; | |
if (AsyncGeneratorPrototype === Object.prototype) { | |
// Fix-up for babel's transform-async-generator-functions | |
AsyncIteratorPrototype = {}; | |
const newAsyncGeneratorPrototype = Object.create(AsyncIteratorPrototype); | |
Object.setPrototypeOf(asyncGeneratorInstancePrototype, newAsyncGeneratorPrototype); | |
} else { | |
AsyncIteratorPrototype = Object.getPrototypeOf(AsyncGeneratorPrototype); |
let c1 = require('./currency-rates-2.json') | |
console.log('Date,', c1.from, 'to', c1.to) | |
let c1b = c1.batchList[0] | |
let ts = c1b.startTime | |
for (let i = 1; i < c1b.rates.length; i += 1) { | |
let actualrate = c1b.rates[i] - c1b.rates[0] | |
console.log(new Date(ts).toLocaleDateString() + ', ' + actualrate) | |
ts += c1b.interval |
// Brute force compound interest loan payment calculator | |
// Inputs | |
let amount = 100_000 // dollars | |
let interest = 10 // percent per year | |
let term = 30 // years | |
// Monthly Payment | |
let monthly_interest = (interest / 12) / 100 | |
let no_of_payments = term * 12 |
#!/bin/bash | |
# pi-bootstrap | |
# | |
# Setup an Ubuntu Raspberry Pi image for headless boot. | |
# | |
# Copyright Nikolay Botev, MIT License | |
# | |
# Default settings |
(function () { | |
function toCtDate(event) { | |
const p2 = s => s.toString().length == 1 ? "0" + s : s; | |
return `${p2(event.getUTCMonth()+1)}/${p2(event.getUTCDate())}/${event.getUTCFullYear()} ${p2(event.getUTCHours())}:${p2(event.getUTCMinutes())}:${p2(event.getUTCSeconds())}`; | |
} | |
const coinMap = { | |
"Dogecoin": "DOGE", | |
"Ethereum": "ETH" | |
} |
[Unit] | |
Description=Turn Off LED %i | |
After=network.target | |
[Service] | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStart=/bin/sh -c 'echo 0 > /sys/class/leds/%i/brightness' | |
ExecStop=/bin/sh -c 'echo 255 > /sys/class/leds/%i/brightness' |
UPSTREAM_IFACE="${1:-eth1}" | |
# IPv4 and IPv6 | |
for iptables in iptables ip6tables; do | |
# :INPUT | |
# - returning traffic | |
sudo $iptables -A INPUT -i $UPSTREAM_IFACE -m state --state ESTABLISHED,RELATED -j ACCEPT | |
# - ping | |
sudo $iptables -A INPUT -i $UPSTREAM_IFACE -p icmp -j ACCEPT |