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/sh | |
wake-computer | |
echo 🚀 Connecting Mosh. | |
mosh user@computer.y |
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
// https://github.com/cjdelisle/cjdns/blob/77259a49e5bc7ca7bc6dca5bd423e02be563bdc5/doc/proxying.md | |
function FindProxyForURL(url, host) { | |
// If we can't resolve this means that this host is IPv4 only. Trying cjdns won't hurt. | |
// It also make IPv4 only hosts connect ot clearnet IPv6 hosts if proxy is IPv6 capable. | |
// If we can resolve check if the host is insice cjdns network space. | |
if (shExpMatch(host, "fc*:*") || !dnsResolve(host) || shExpMatch(dnsResolve(host), "fc*:*")) { | |
return "SOCKS5 localhost:8080"; | |
} | |
return "DIRECT"; |
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 | |
# Source: https://superuser.com/a/1030779 | |
# standard sshd config path | |
SSHD_CONFIG=/etc/ssh/sshd_config | |
# helper functions | |
function tablize { | |
awk '{printf("| %-7s | %-7s | %-47s |\n", $1, $2, $3)}' |
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
const choo = require('choo') | |
const app = choo() | |
app.model({ | |
state: { title: 'Set the title' }, | |
reducers: { | |
update: (action, state) => ({ title: action.value }) | |
}, | |
subscriptions: [ | |
(send) => setInterval(() => {send('print', { payload: 'dog?' })}, 1000) |
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
var hyperlog = require('hyperlog') | |
var levelup = require('levelup') | |
var steed = require('steed') | |
var db1 = levelup('./db1', { db: require('memdown') }) | |
var db2 = levelup('./db2', { db: require('memdown') }) | |
var db3 = levelup('./db3', { db: require('memdown') }) | |
var log1 = hyperlog(db1) | |
var log2 = hyperlog(db2) |
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
/* | |
A proper divisor of a positive integer n is any divisor | |
of n other than n itself. | |
A number n is called deficient if the sum of its proper | |
divisors is less than n and it is called abundant if | |
this sum exceeds n. | |
As 12 is the smallest abundant number, | |
1 + 2 + 3 + 4 + 6 = 16, the smallest number that can be |
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
SetEnvIf Request_URI "^(.*)" PORT=65300 | |
RewriteEngine On | |
RewriteBase / | |
# CORS | |
Header add Access-Control-Allow-Origin "*" | |
# HTTPS | |
RewriteCond %{HTTPS} !=on |
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
var inherits = require( 'inherits') | |
var EventEmitter = require( 'events').EventEmitter | |
var instance | |
inherits( Dispatcher, EventEmitter) | |
module.exports = instance || | |
(instance = new Dispatcher()) | |
function Dispatcher (opts){ |
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
var signalhub = require( 'signalhub') | |
var argv = require( 'minimist')( process.argv.slice( 2)) | |
var Peer = require('simple-peer') | |
var uid = require('cuid')() | |
var log = require('fancy-log') | |
// hub | |
var hub = signalhub( 'signalhubTest', [ | |
'http://x:7000' ]) |
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
ARRAY=( | |
hello | |
world | |
) | |
i=0 | |
while [ $i -lt ${#ARRAY[@]} ]; do | |
echo ${ARRAY[i]} | |
((i++)) | |
done |