26 Apr 2024
Access the database through CLI with sudo -u postgres psql. \q to get out again. Default port is 5432.create database mydb;
create user myuser with encrypted password 'mypass';
grant all privileges on database mydb to myuser;
drop database mydb;
drop user myuser;
It is doesn't accept the above, try restarting the service (sudo service postgresql restart).
pg_dump --dbname=postgresql://myuser:mypass@192.168.1.10:5432/mydb > mydb.sql
Replace myuser with your username, mypass with your password, 192.168.1.10 with your servers IP address and mydb with your database. The > mydb.sql at the end simply dumps the output into a file named mydb.sql. Change it to suit your needs.
SELECT pg_catalog.setval('public.posts_id_seq', 23, true);
Your sequence will probably have a naming convention similar to TABLENAME_id_seq. My table from the example above is named posts.
How to easily web scrape any website with Python
Published 2024-05-03
Datahoarding
Notes
Python
Web development
Learn how to easily web scrape any website using Python. I go through the various techniques I use.
Read the post →Privacy policy
Published 2024-07-28
Privacy/data policy for the website PhilipSoerensen.com
Read the post →Converting images
Published 2024-05-14 — Updated 2024-07-28
Converting images to and from various different formats (AVIF, DNG, WEBP etc.) with Ubuntu CLI.
Read the post →