Skip to content

Instantly share code, notes, and snippets.


Joseph Kariuki jkariukidev

View GitHub Profile
jkariukidev /
Last active Feb 9, 2022
GeoNode 3.2 Advanced Installation in Ubuntu 18.04

Snippets on GeoNode 3.2 Advanced Installation in Ubuntu 18.04 LTS

Installing GeoNode 3.2.* in clean Ubuntu 18.04 using the official documentation results in some errors due to the following issues:

  • Default Python in the OS is Python version 3.6 while version 3.8 is required for GeoNode 3.2
  • The GDAL version available on the OS is 2.2.3 while version 3.3.2 is required. To confirm the above run the follwing commands:
  1. which python to check the existing python version location. It shows the following output.
python: /usr/bin/python3.6 /usr/bin/python3.6m /usr/lib/python3.6 /usr/lib/python3.7 /usr/lib/python2.7 /etc/python3.6 /etc/python2.7 /usr/local/lib/python3.6 /usr/include/python3.6m /usr/share/python
View Completely Uninstall LAMP Ubuntu
# This will remove Apache
sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin
sudo apt remove apache2.*
sudo apt-get autoremove
whereis apache2
sudo rm -rf /etc/apache2
import cmislib
client = cmislib.CmisClient('', 'Admin', 'alfresco')
repo = client.defaultRepository
root = repo.rootFolder
myFolder = root.createFolder('testFolder')
jkariukidev /
Last active Jul 7, 2020
Get a repeated number in any given array (assumption that there is one repeated number).
# Get the most repeated number in a given list
def max_freq(some_list):
Gets the most repeated number in a list.
:param some_list: A given list of numbers having one that is most
:type some_list: list
:rtype max_item: object
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
def file_names():
folder = QFileDialog.getExistingDirectory()
files = QDir(folder).entryList(QDir.Files)
for file in files:
View Backup_postgresql_db
# defining pgpassword for interactive logging
export PGPASSWORD=postgres
mkdir "$backup_dir$(date '+%d-%b-%Y')"
date_dir="$backup_dir$(date '+%d-%b-%Y')"
touch $logfile
# scan through present databases
databases=`psql -h localhost -U postgres -q -c "\l" | sed -n 4,/\eof/p | grep -v rows\) | grep -v template0 | grep -v template1 | awk {'print $1'}`
jkariukidev /
Created Mar 21, 2020 — forked from santisbon/
Bring your feature branch up to date with master. Deploying from Git branches adds flexibility. Bring your branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master

jkariukidev /
Created May 31, 2019
CMIS repository test
from cmislib import CmisClient
# testing cmis by getting repository information
def repository():
client = CmisClient('http://localhost:8081/alfresco/api/-default-/public/cmis/versions/1.1/atom',
'<user>', '<password>')
repo = client.defaultRepository
repo_info =
import sys
from PyQt4.QtCore import QTimer, QVariant, SIGNAL
from PyQt4.QtGui import *
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply
from PyQt4.QtWebKit import QWebView
html = """<html>
<title>Test page for the download:// scheme</title>
jkariukidev /
Created May 7, 2019 — forked from femmerling/
I have to create user authentication using python-ldap. After googling around and trying out stuffs, this is the final code for you to use. Please remember to adjust the user_dn, and base_dn accordingly to the format used in your LDAP server.
# to be able to import ldap run pip install python-ldap
import ldap
if __name__ == "__main__":
username = "someuser"
password= "somepassword"
# the following is the user_dn format provided by the ldap server
user_dn = "uid="+username+",ou=someou,dc=somedc,dc=local"