Skip to content

Instantly share code, notes, and snippets.

@shymonk
shymonk / .zshrc
Created June 22, 2026 06:31
agyaml
agyaml() {
local key="$1"
local root="${key%%.*}"
find . -type f \( -name '*.yml' -o -name '*.yaml' \) -print0 |
while IFS= read -r -d '' f; do
if yq -e ".$key" "$f" >/dev/null 2>&1; then
echo "==> $f"
#!/usr/bin/env python
# coding: utf-8
import operator
def dayOfYear(year, month, day):
# we suppose input is always correct
if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0):
monthDays = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
else:
@shymonk
shymonk / customize-save-in-django-admin-inline-form.org
Last active February 5, 2026 18:38
How to customize save in django admin inline form?

Customize Save In Django Admin Inline Form

Background

This is a common case in django ORM.

from django.db import models

class Author(models.Model):