Skip to content

Instantly share code, notes, and snippets.

@bf
bf / debian-10-nginx-letsencrypt-hugo.sh
Last active Jul 12, 2020
Debian 10 with Nginx, Letsencrypt and Hugo
View debian-10-nginx-letsencrypt-hugo.sh
# 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 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 $$
DECLARE
-- vars
insert_id int;
BEGIN
-- do something
FOR r IN
@bf
bf / CreateNewUserAndDatabase.sh
Last active Jun 21, 2016
PostgreSQL: Create new User and Database
View CreateNewUserAndDatabase.sh
# 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;