Skip to content

Instantly share code, notes, and snippets.

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 / gist:64002d6e774d19bdba0e67380f97c4e5
Created Jul 27, 2022
Install Code deploy agent on Ubuntu 22.04 LTS
View gist:64002d6e774d19bdba0e67380f97c4e5
!/bin/bash
sudo apt-get update
sudo apt-get install ruby-full ruby-webrick wget -y
cd /tmp
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/releases/codedeploy-agent_1.3.2-1902_all.deb
@d-kahara
d-kahara / create-superuser.py
Created Apr 22, 2020 — forked from c00kiemon5ter/create-superuser.py
Extend Django's management createsuperuser command to allow non-interactive creation of a superuser with a password.
View create-superuser.py
"""
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
View update_vscode.sh
#!/bin/bash
wget https://vscode-update.azurewebsites.net/latest/linux-deb-x64/stable -O /tmp/code_latest_amd64.deb
sudo dpkg -i /tmp/code_latest_amd64.deb
@d-kahara
d-kahara / test.ipynb
Created Jul 5, 2019
Jupyter Notebook tutorial
View test.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@d-kahara
d-kahara / postgres-cheatsheet.md
Created Dec 30, 2018 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet
View postgres-cheatsheet.md

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 / test_profile.py
Created Dec 20, 2018
This Gist showcases a unit test in Django
View test_profile.py
"""
Gist handles testting a user model
using django
"""
from django.test import TestCase
# import the user model
from users.models import User
class UserTestCase(TestCase):
@d-kahara
d-kahara / SortedListAdapter.java
Created Nov 27, 2017 — forked from xaverkapeller/SortedListAdapter.java
Implementation of a RecyclverView Adapter base class which uses a SortedList internally
View SortedListAdapter.java
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;