From A, set up a pipe for sending data from A to B
a@A: ssh -v -N -L 2223:127.0.0.1:2222 b@B
To test it, first open a listener on B
#!/usr/bin/env python3 | |
import argparse | |
import textwrap | |
import subprocess | |
import os | |
import datetime | |
#import pdb | |
#import random | |
import time |
downloaded (https://downloads.openwrt.org/snapshots/targets/brcm2708/bcm2710/openwrt-brcm2708-bcm2710-rpi-3-ext4-factory.img.gz) and set up SD card
modify /etc/network to set ip address, gateway, dns
config interface 'lan'
option type 'bridge'
option ifname 'eth0'
#!/usr/bin/env python2 | |
#coding=utf-8 | |
# | |
# Openwrt Package Grabber | |
# | |
# Copyright (C) 2014 http://www.shuyz.com | |
# modified 2019 craigphicks | |
# | |
import urllib2 |
#!/bin/bash | |
# | |
# | |
#<UDF name="ssuser" Label="Sudo user username?" example="username" /> | |
#<UDF name="sspassword" Label="Sudo user password?" example="strongPassword" /> | |
#<UDF name="sspubkey" Label="SSH pubkey (installed for root and sudo user)?" example="ssh-rsa ..." /> | |
# initial needfuls | |
apt-get -o Acquire::ForceIPv4=true update |
Forwarding X11
over ssh
without using xauth
Remote /etc/ssh/sshd_config
:
X11Forwarding no
X11DisplayOffset 10
X11UseLocalhost yes
x=10;
function test(){
var x=20;
var obj = {x:30};
function logargs(t,arg1,arg2,arg3,arg4) {
console.log(`(${t}) this.x=${this.x},x=${x},obj.x=${obj.x},${arg1},${arg2},${arg3},${arg4.x}`);
}
logargs("A",this.x,x,obj.x,obj);
setTimeout(logargs,0,"B",this.x,x,obj.x,obj);
function showDeep(t){ | |
let o=t | |
do { | |
console.log(`--- ${o.constructor.name}`) | |
for (let k of Reflect.ownKeys(o)) { | |
let d = Reflect.getOwnPropertyDescriptor(o,k) | |
if (JSON.stringify(d.value)!==undefined) { | |
console.log(`${k} : ${JSON.stringify(d.value)}`) | |
if (k==='stack') | |
console.log("") // funky |
A singleton makes sense when it prevent multiple access to a resource than must not be accessed in that way. But sometimes a singleton design is used because it is sufficient for expected usage. But that may block expanded usage unecessarily.
ES6 dynamic import can import a singelton module into a closure allowing a singleton to become a non-singleton class. See the file yargs-class.mjs
below.
The result of test-yargs0class.mjs -
argv[0]= {
function makeNonCryptoRandomAlphaNumString(length) { | |
function tf(n) { | |
if (n < 26) return 65 + n | |
else if (n < 52) return 97 + n - 26 | |
else return 48 + n - 52 | |
} | |
var result = '' | |
for (var i = 0; i < length; i++) { | |
let idx = Math.floor(Math.random() * 62) | |
result += String.fromCharCode(tf(idx)) |