Reverse Proxy in Apache

Scenario: I have an apache server running on (localhost) that i want to use to access a python/django project that is being served on a private server on localhost:8000 (specifically at /museus). On my browser, i want to type: and it magically shows me what’s on localhost:8000/museus, without letting me know that there are… Read More »

PostgreSQL database Backup and Restore from the CLI

Warning: count(): Parameter must be an array or an object that implements Countable in /home/wwwmani/public_html/42/wp-content/plugins/wp-shkshell/wp-shkshell.php on line 59

Quick note about how to backup and restore a PostgreSQL database from the command line. Things to know: – Name of the database you want to backup; – Username and password of the database user; – your way around a command line – at least how to open it or who to ask to open… Read More »

Check internet speed from the command line

So, i was fiddling with my raspberry pi and thought about checking the internet download and upload speed. After a few searches and tests, this seems to be the easiest and finest solution: go to the cli and type: [user]$ wget -O speedtest-cli wait for the python script download, then: [user]$ chmod +x speedtest-cli… Read More »

Get last modified and change date of file in linux

Short post to keep things simple, and i also have better things to do: You had a great script doing skynet stuff on your server, but you noticed it stopped tracking the missile network sometime last week. Could someone have changed it? You know the last time you edited it, sometime around november 1976, so… Read More »

Find Apache httpd.conf file location

So i was in the middle of a serious error debug session where some of the errors seemed to be apache’s fault. Probably some configuration adjustments, but for that i needed to see the current configuration (and change it if need be). But where is the httpd.conf file? After some practice, we easily look for… Read More »

How to get current year, month, day, etc. in python

Ok, so you have been coding for quite some long hours this week and you suddenly realie you dont even know what day it is. Or even year (yes, it happens). Since you are on the python command line, here’s what you can do: (ok, so the scenario could be slightly different…still, the method to… Read More »

Django template to respect plain text field linebreaks

If you have a text field with linebreaks in your nice django admin and your cool template refuses to respect them, use this in your template: this replaces newlines with HTML and newlines with blank lines with Learn tons of great stuff from your trusty Django docs: – Built-in template tags and filters

Remove repeated adjacent characters from string

Given a string like: “aabbdeeeef” or “bbbbbbb” we want to output: “abdef” and “b” respectively. here are a few ways to do it in Python:

Quickly change a Django user password

So you have this nice django site, you try to access the admin to change some minor thing and you completely forgot (and didnt save somewhere) the password of the only user in the system – so many dont’s in that sentence, but anyway… Since you are the developer, you can simply do this (assuming… Read More »

PostgreSQL – PostGIS versions

Login to your postgresql on some database and go: To get PostgreSQL version: To get versions for PostGIS, GEO, etc.: