Skip to content

Instantly share code, notes, and snippets.

View aldookware's full-sized avatar
:octocat:
Focusing

Aldo Okware aldookware

:octocat:
Focusing
View GitHub Profile
@aldookware
aldookware / ubuntudocker.sh
Last active September 5, 2022 05:31 — forked from fredhsu/ubuntudocker.sh
Shell script to install Docker CE on ubuntu and post-install user configuration
#!/bin/bash
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
"""
Django ORM Optimization Tips
Caveats:
* 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
aldookware / django_stream_queryset_to_csv.md
Created August 1, 2022 21:56 — forked from niuware/django_stream_queryset_to_csv.md
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 writers.py file:
import csv
from django.http import StreamingHttpResponse
@aldookware
aldookware / slack_handler.py
Created July 14, 2022 10:55 — forked from blakev/slack_handler.py
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
aldookware / .vimrc
Created August 6, 2021 15:53 — forked from miguelgrinberg/.vimrc
My .vimrc configuration for working in Python with vim
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let need_to_install_plugins = 1
endif
call plug#begin()
Plug 'tpope/vim-sensible'
@aldookware
aldookware / 1.srp.py
Created June 21, 2021 18:42 — forked from dmmeteo/1.srp.py
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
aldookware / docker-cleanup-resources.md
Created August 20, 2020 07:27 — forked from bastman/docker-cleanup-resources.md
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: https://github.com/chadoe/docker-cleanup-volumes

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

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

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

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

@aldookware
aldookware / conda_cheat
Created March 17, 2019 09:24 — forked from qheuristics/conda_cheat
conda cheatsheet
to create a new environment
conda create -n mynewenviron package1 package2 etc
conda create -n newenv --clone ~anaconda
to remove an environment
conda remove -n myenvirontoremove --all
always start with