Skip to content

Instantly share code, notes, and snippets.


Aldo Okware aldookware

  • @andela & @openInvestco
  • Kampala, Uganda
View GitHub Profile
aldookware /
Last active September 5, 2022 05:31 — forked from fredhsu/
Shell script to install Docker CE on ubuntu and post-install user configuration
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
curl -fsSL | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] \
Django ORM Optimization Tips
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
# ---------------------------------------------------------------------------
aldookware /
Created August 1, 2022 21:56 — forked from niuware/
How to stream a CSV file from a large QuerySet using Django's StreamingHttpResponse

Stream a CSV file from a QuerySet using StreamingHttpResponse

This is a sample on how to stream the results of a large QuerySet into a CSV file using Django StreamingHttpResponse class.

  1. Add the CSVStream class in your project, for example a file:
import csv
from django.http import StreamingHttpResponse
aldookware /
Created July 14, 2022 10:55 — forked from blakev/
Python logging handler for publishing to a slack channel.
import os
import time
import json
import socket
import logging
from slacker import Slacker, Error as SlackerError
class SlackChannelHandler(logging.Handler):
aldookware / .vimrc
Created August 6, 2021 15:53 — forked from miguelgrinberg/.vimrc
My .vimrc configuration for working in Python with vim
View .vimrc
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
let need_to_install_plugins = 1
call plug#begin()
Plug 'tpope/vim-sensible'
aldookware /
Created June 21, 2021 18:42 — forked from dmmeteo/
SOLID Principles explained in Python with examples.
Single Responsibility Principle
“…You had one job” — Loki to Skurge in Thor: Ragnarok
A class should have only one job.
If a class has more than one responsibility, it becomes coupled.
A change to one responsibility results to modification of the other responsibility.
class Animal:
def __init__(self, name: str):
aldookware /
Created August 20, 2020 07:27 — forked from bastman/
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see:

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

aldookware /
Created July 3, 2020 20:05 — forked from FrancesCoronel/
A sample README for all your GitHub projects.


INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

aldookware /
Last active August 20, 2020 08:03
git commands I use often

To initialize a new local repo.

$ git init

To add newly created files to staging

$ git add <file-name> or . for all new files.

To clone a repo

aldookware /
Last active May 21, 2019 20:26
My terminal setup
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
orange=$(tput setaf 166);
purple=$(tput setaf 125);
yello=$(tput setaf 228);
green=$(tput setaf 28);
white=$(tput setaf 15);
reset=$(tput sgr0);
bold=$(tput bold);