Skip to content

Instantly share code, notes, and snippets.

bf /
Last active Jul 12, 2020
Debian 10 with Nginx, Letsencrypt and Hugo
# remove annoying mouse handling from vim
echo "set mouse -=a" > ~/.vimrc
# install packages
sudo apt install -y git hugo python3-acme python3-certbot python3-mock python3-openssl \
python3-pkg-resources python3-pyparsing python3-zope.interface python3-certbot-nginx
# add user, follow instructions, generate strong password with pwgen 100
adduser foobar
bf / migration.sql
Created Jun 21, 2016
PostgreSQL Anonymous Code Block Database Migration
View migration.sql
-- PostgreSQL database migration to split up one table into two smaller ones and store the new ID with the original table
DO $$
-- vars
insert_id int;
-- do something
bf /
Last active Jun 21, 2016
PostgreSQL: Create new User and Database
# To create a new postgres database with a new user/password combination
# we first have to log in as the postgres user
sudo su - postgres;
# now we are the "postgres" user which is allowed to create new database users
# we use the -P parameter to create a new user called "annie". Annie uses a password.
createuser -P annie;
# finally, we create Annie's database
createdb -O annie annies_database;