Skip to content

Instantly share code, notes, and snippets.

View d-kahara's full-sized avatar
:octocat:
Talk is cheap, show me the code 🙂

David Kahara d-kahara

:octocat:
Talk is cheap, show me the code 🙂
  • SIEAL
  • Nairobi, Kenya
View GitHub Profile
@d-kahara
d-kahara / create-superuser.py
Created April 22, 2020 12:07 — forked from c00kiemon5ter/create-superuser.py
Extend Django's management createsuperuser command to allow non-interactive creation of a superuser with a password.
"""
Extend createsuperuser command to allow non-interactive creation of a
superuser with a password.
Instructions:
mkdir -p path-to-your-app/management/commands/
touch path-to-your-app/management/__init__.py
touch path-to-your-app/management/commands/__init__.py
@d-kahara
d-kahara / postgres-cheatsheet.md
Created December 30, 2018 20:16 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@d-kahara
d-kahara / SortedListAdapter.java
Created November 27, 2017 07:08 — forked from xaverkapeller/SortedListAdapter.java
Implementation of a RecyclverView Adapter base class which uses a SortedList internally
import android.content.Context;
import android.support.v7.util.SortedList;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;