Skip to content

Instantly share code, notes, and snippets.

renchap /
Last active Jan 1, 2021
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
paulirish /
Last active Jul 29, 2021
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

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.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
View hashbackup.txt
1. Copy ssh public key to server:
[jim@mb hbdev]$ scp ~/.ssh/
100% 392 0.4KB/s 00:00
2. Create a local HashBackup backup directory:
View test kv db.go
package main
import (
func getBuf(n int) []byte {
wandernauta / sp
Last active Jul 26, 2021
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
View sp
#!/usr/bin/env bash
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.


  1. Don't run as root.
  2. For sessions, set httpOnly (and secure to true if running over SSL) when setting cookies.
  3. Use the Helmet for secure headers:
  4. Enable csrf for preventing Cross-Site Request Forgery:
  5. Don't use the deprecated bodyParser() and only use multipart explicitly. To avoid multiparts vulnerability to 'temp file' bloat, use the defer property and pipe() the multipart upload stream to the intended destination.
setoff() {
for display in `xrandr | awk '/ disconnected/ {print $1}'`; do
echo "maybe disabling $display";
xrandr --output $display --off;
View gist:541501
var sys = require('sys'),
YUI = require("yui3").YUI;
filter: 'debug',
_logExclude: {
'attribute': true,
'base': true,
'get': true,
'loader': true,