Skip to content

Instantly share code, notes, and snippets.

@bf
bf / debian-10-nginx-letsencrypt-hugo.sh
Last active July 12, 2020 20:44
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
bf / migration.sql
Created June 21, 2016 22:32
PostgreSQL Anonymous Code Block Database Migration
-- PostgreSQL database migration to split up one table into two smaller ones and store the new ID with the original table
DO $$
DECLARE
-- vars
insert_id int;
BEGIN
-- do something
FOR r IN
@bf
bf / CreateNewUserAndDatabase.sh
Last active June 21, 2016 16:42
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;