next.js, nginx, reverse-proxy, ssl
$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt
MIT License | |
Copyright (c) 2020 wreulicke | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
# So interestingly, Signature seems to be twice as fast in Python 3.6 and 3.7 as it | |
# was in Python 3.3 and 3.4. However, it is still 6-18 times slower than the old | |
# getargspec or getfullargspec that was in Python 3.3. | |
Python 2.7 getargspec (doesn't use Signature) : specimen_one (6 args) : 0.0503 | |
Python 2.7 getargspec (doesn't use Signature) : specimen_two (0 args) : 0.0496 | |
Python 2.7 getargspec (doesn't use Signature) : specimen_three (6 args) : 0.0500 | |
Python 2.7 getargspec (doesn't use Signature) : specimen_four (13 args) : 0.0652 | |
Python 3.3 getfullargspec (doesn't use Signature) : specimen_one (6 args) : 0.0539 |
CREATE SEQUENCE public.global_id_seq; | |
ALTER SEQUENCE public.global_id_seq OWNER TO postgres; | |
CREATE OR REPLACE FUNCTION public.id_generator() | |
RETURNS bigint | |
LANGUAGE 'plpgsql' | |
AS $BODY$ | |
DECLARE | |
our_epoch bigint := 1314220021721; | |
seq_id bigint; |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
#!/bin/bash | |
# generate new personal ed25519 ssh keys | |
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>" | |
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_robtn -C "rob thijssen <rob@rob.tn>" | |
# generate new host cert authority (host_ca) ed25519 ssh key | |
# used for signing host keys and creating host certs | |
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network |
from functools import wraps | |
from timeit import default_timer | |
import gevent | |
from gevent.queue import Queue | |
def gevent_throttle(calls_per_sec=0): | |
"""Decorates a Greenlet function for throttling.""" | |
interval = 1. / calls_per_sec if calls_per_sec else 0 | |
def decorate(func): | |
blocked = [False] # has to be a list to not get localised inside the while loop |