| #!/bin/sh | |
| # qemu-img create -f qcow2 mac_hdd.img 64G | |
| # echo 1 > /sys/module/kvm/parameters/ignore_msrs | |
| # | |
| # Type the following after boot, | |
| # -v "KernelBooter_kexts"="Yes" "CsrActiveConfig"="103" | |
| # | |
| # printf 'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256)) | |
| # |
| #!/bin/sh | |
| SWAPSIZE=3 # IN GB | |
| SYSTEM_NAME=aerozine # Hostname and used in ZFS structure (zroot/sys/${SYSTEM_NAME}/ROOT/default) | |
| USER=xunil # Initial admin user for the system | |
| # Archlinux on ZFS Root on LUKS setup script (v1.0) | |
| # | |
| # USAGE: ./ArchLinux_ZFS_LUKS_Setup.sh /dev/sda | |
| # |
| ########################################################################### | |
| # | |
| ## @file database.py | |
| # | |
| ########################################################################### | |
| import sqlite3 | |
| ########################################################################### | |
| # |
| >>> sample = {"a":2,"b":{"c":44}} | |
| >>> sample.get("b",{}).get("c") # is gross | |
| >>> | |
| >>> class nestdict(dict): | |
| ... def __floordiv__(self, k): | |
| ... v = self.get(k) | |
| ... if isinstance(v, dict): return nestdict(v) | |
| ... return v | |
| ... | |
| >>> z = nestdict(sample) |
| import tornado.web | |
| class route(object): | |
| """ | |
| decorates RequestHandlers and builds up a list of routables handlers | |
| Tech Notes (or "What the *@# is really happening here?") | |
| -------------------------------------------------------- | |
| Everytime @route('...') is called, we instantiate a new route object which |
| # Originally from https://github.com/guyc/py-gaugette/blob/master/gaugette/font5x8.py | |
| # Contains ASCII 32 (space) through ASCII 90 (Z) | |
| cols = 5 | |
| rows = 8 | |
| bytes = [ | |
| 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 0x00, 0x00, 0x5F, 0x00, 0x00, | |
| 0x00, 0x07, 0x00, 0x07, 0x00, | |
| 0x14, 0x7F, 0x14, 0x7F, 0x14, |
This gist assumes you are migrating an existing site for www.example.com — ideally WordPress — to a new server — ideally Ubuntu Server 16.04 LTS — and wish to enable HTTP/2 (backwards compatibile with HTTP/1.1) with always-on HTTPS, caching, compression, and more. Although these instructions are geared towards WordPress, they should be trivially extensible to other PHP frameworks, other FastCGI backends, and even non-FastCGI backends (using proxy in lieu of fastcgi in the terminal Caddyfile stanza).
Quickstart: Use your own naked and canonical domain names instead of example.com and www.example.com and customize the Caddyfile and VCL provided in this gist to your preferences!
These instructions target Varnish Cache 4.1, PHP-FPM 7.0, and Caddy 0.10. (I'm using MariaDB 10.1 as well, but that's not relevant to this guide.)
The standard names for indexes in PostgreSQL are:
{tablename}_{columnname(s)}_{suffix}
where the suffix is one of the following:
pkeyfor a Primary Key constraint;keyfor a Unique constraint;exclfor an Exclusion constraint;idxfor any other kind of index;
Accessing a subnet that is behind a WireGuard client using a site-to-site setup
We want to access a local subnet remotely, but it is behind a NAT firewall and we can't setup port forwarding. Outgoing connections work, but all incoming connections get DROPPED by the ISP's routing policy.