Two files:
/etc/usb_modeswitch.d/rtl8821cu
/usr/share/usb_modeswitch/0bda:1a2b
TargetVendor=0x0bda
TargetProduct=0x1a2b
StandardEject=1
const got = require('got'); | |
const stream = require('stream'); | |
const fs = require('fs'); | |
const { promisify } = require('util'); | |
const pipeline = promisify(stream.pipeline); | |
// instantiate the download stream - use options to set authorization header etc. if needed | |
let downStream = got.stream('https://example.com/download'); | |
downStream.on('response', response => { |
// app.js: register the route. In our case, we don't want authorization for this route | |
app.use('/healthcheck', require('./routes/healthcheck.routes')); | |
// healthcheck.routes.js: return a 2xx response when your server is healthy, else send a 5xx response | |
import express from 'express'; | |
const router = express.Router({}); | |
router.get('/', async (_req, res, _next) => { | |
// optional: add further things to check (e.g. connecting to dababase) |
'use strict'; | |
/* | |
Queue.js | |
A class to represent a queue | |
Created by Kate Morley - https://code.iamkate.com/ - and released under the terms | |
of the CC0 1.0 Universal legal code: |
Two files:
/etc/usb_modeswitch.d/rtl8821cu
/usr/share/usb_modeswitch/0bda:1a2b
TargetVendor=0x0bda
TargetProduct=0x1a2b
StandardEject=1
const ip4RegEx = /^(?:(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(\.(?!$)|$)){4}$/ | |
/* | |
//valid | |
127.0.0.1 | |
192.168.1.1 | |
192.168.1.255 | |
255.255.255.255 | |
0.0.0.0 | |
1.1.1.1 |
# checkout, compile & install | |
git clone https://github.com/facebook/watchman.git | |
cd watchman/ | |
git checkout v4.9.0 | |
sudo apt-get install -y autoconf automake build-essential python-dev libssl-dev libtool | |
./autogen.sh | |
./configure | |
make | |
sudo make install |
# make sure zfs autoexpand is enabled (only needed once) | |
sudo zpool set autoexpand=on lxd | |
sudo truncate -s 50G /var/lib/lxd/zfs.img | |
# Make zfs realize the fact that partition has been changed and make zpool | |
# use the new partition which is actually the same one | |
sudo zpool online -e lxd /var/lib/lxd/zfs.img /var/lib/lxd/zfs.img |
Managing multiple Tor processes on one host | |
=========================================== | |
Due to Tor's internal architecture, running only one Tor process per physical | |
host is often not enough. As a thumb rule, you should run one Tor process per | |
physical CPU core to make full use of the host's CPU power. This, however | |
brings with it other difficulties: The tor network limits the number of Tor | |
relays per IP in the consensus to 2. Also, the relay nodes should be rechable | |
on Port 80 and 443 since those ports are often unfiltered and unblocked. |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |