Skip to content

Instantly share code, notes, and snippets.

View jackton1's full-sized avatar

Tonye Jack jackton1

View GitHub Profile
@zulhfreelancer
zulhfreelancer / zsh-timestamp.md
Last active July 19, 2025 05:34
How to add timestamp on right hand side of ZSH / iTerm2 terminal prompt?

Add the following snippet at the bottom of ~/.zshrc file.

Option 1 - Just time

RPROMPT='[%D{%L:%M:%S}] '$RPROMPT
@jackton1
jackton1 / restricted_fields.py
Created July 11, 2019 21:30
Restricting DRF serialized fields using only and defer.
from collections import OrderedDict
from rest_framework.fields import SkipField
from rest_framework.relations import PKOnlyObject
class RestrictedFieldsSerializerMixin(object):
"""
API Serializer mixin which provides support for restricting serialized data to only a subset of fields.
@sameerkumar18
sameerkumar18 / yourapp_admin.py
Last active October 7, 2024 18:21
Django Admin: Celery Retry Task by ID
# Add this code in any Django app's admin.py
# Works for all Task Statuses; you can filter them in line 12.
import ast
import importlib
import json
from django.contrib import admin
from django.contrib import messages
from django.utils.safestring import mark_safe