Skip to content

Instantly share code, notes, and snippets.

View wangonya's full-sized avatar
🎧
Wired in

Kelvin Wangonya wangonya

🎧
Wired in
View GitHub Profile
@wangonya
wangonya / README.md
Created January 20, 2022 12:27 — forked from jaredculp/README.md
Void Linux

Void Linux Macbook Air 2013

Flash installer:

$ dd if=void-live-x86_64-musl-20181111.iso of=/dev/X bs=1m

login as root:voidlinux

Base Install:

@wangonya
wangonya / conftest.py
Created June 26, 2021 05:10 — forked from jeroenbrouwer/conftest.py
Setting up django-tenant-schemas with a "fake" pytest tenant
from django.core.management import call_command
from django.db import connection
from tenant_schemas.utils import get_public_schema_name, get_tenant_model
import pytest
TenantModel = get_tenant_model()
def get_or_create_tenant(*, schema_name, migrate=True):
try:
@wangonya
wangonya / 📊 Weekly development breakdown
Last active July 29, 2022 01:47
📊 Weekly development breakdown
Python 17 hrs 32 mins ███████████▊░░░░░░░░░ 56.4%
INI 4 hrs 12 mins ██▊░░░░░░░░░░░░░░░░░░ 13.5%
Lua 2 hrs 28 mins █▋░░░░░░░░░░░░░░░░░░░ 8.0%
JavaScript 1 hr 50 mins █▏░░░░░░░░░░░░░░░░░░░ 5.9%
sh 1 hr 34 mins █░░░░░░░░░░░░░░░░░░░░ 5.1%
@wangonya
wangonya / PrimaryKeyInObjectOutRelatedField.py
Created March 22, 2021 08:51 — forked from jmichalicek/PrimaryKeyInObjectOutRelatedField.py
Django Rest Framework RelatedField allows a PK for input but returns a fully serialized model in response
class PrimaryKeyInObjectOutRelatedField(relations.PrimaryKeyRelatedField):
"""
Django Rest Framework RelatedField which takes the primary key as input to allow setting relations,
but takes an optional `output_serializer_class` parameter, which if specified, will be used to
serialize the data in responses.
Usage:
class MyModelSerializer(serializers.ModelSerializer):
related_model = PrimaryKeyInObjectOutRelatedField(
queryset=MyOtherModel.objects.all(), output_serializer_class=MyOtherModelSerializer)
@wangonya
wangonya / README-Template.md
Created November 28, 2019 11:09 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@wangonya
wangonya / gdrive-vid-timestamper.py
Created June 7, 2019 14:14
A python script to generate a timestamp link for google drive videos
# How it works:
# - Download and run it (python3 gdrive-vid-timestamper.py)
# - Enter the google drive link for your video. Make sure the link ends at the `view` part e.g `https://drive.google.com/file/d/sdf/view`
# - Enter the time you want e.g `8:36`
# - A link with the timestamp embedded in seconds will be returned
# - The app continues running, waiting for the next time to be input. `ctrl-c` to terminate it.
def converter(link):
_time = input("Enter time in 'm:s' format: ") # e.g 2:01
to_convert = _time.split(":")
time_in_seconds = (int(to_convert[0])*60) + int(to_convert[1])