Skip to content

Instantly share code, notes, and snippets.

View yakimka's full-sized avatar
💭
import __hello__

yakimka

💭
import __hello__
View GitHub Profile
@chr15m
chr15m / aider-convention-scraper
Last active June 8, 2025 01:29
Convert documentation URLs to Markdown "convention" files to be used by aider and other LLMs
#!/bin/sh
# Scrapes documentation from a URL and converts it to Markdown suitable for aider convention files
# to provide context to the LLM.
if [ $# -eq 0 ]; then
echo "Usage: $(basename "$0") <URL> [URL...]"
echo
echo "Generate aider 'convention' Markdown context from documentation URLs."
echo "suitable for providing LLM context about a project's conventions and style."
@samuelcolvin
samuelcolvin / python-people.md
Last active January 26, 2025 17:16
An incomplete list of people in the Python community to follow on Twitter and Mastodon.

Python People

(Updated 2022-11-16 with suggestions from comments below, Twitter and Mastodon)

An incomplete list of people in the Python community to follow on Twitter and Mastodon.

With the risk that Twitter dies, I'd be sad to lose links to interesting people in the community, hence this list.

I would love you to comment below with links to people I've missed.

@spookylukey
spookylukey / after_fetch_queryset_mixin.py
Created September 2, 2021 20:31
AfterFetchQuerySetMixin for Django
class AfterFetchQuerySetMixin:
"""
QuerySet mixin to enable functions to run immediately
after records have been fetched from the DB.
"""
# This is most useful for registering 'prefetch_related' like operations
# or complex aggregations that need to be run after fetching, but while
# still allowing chaining of other QuerySet methods.
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@jirihnidek
jirihnidek / sub-sub-command.py
Last active May 12, 2025 03:36
Python example of using argparse sub-parser, sub-commands and sub-sub-commands
"""
Example of using sub-parser, sub-commands and sub-sub-commands :-)
"""
import argparse
def main(args):
"""
Just do something
@adamchainz
adamchainz / double_checked_lock_iterator.py
Created February 28, 2020 17:18
double_checked_lock_iterator.py
# refactor of https://lukeplant.me.uk/blog/posts/double-checked-locking-with-django-orm/
# untested
def double_checked_lock_iterator(queryset):
for item_pk in queryset.values_list("pk", flat=True):
with transaction.atomic():
try:
yield queryset.select_for_update(skip_locked=True).get(id=item_pk)
except queryset.model.DoesNotExist:
pass
@zoilomora
zoilomora / README.md
Last active April 20, 2025 20:46
How to disable systemd-resolved in Ubuntu

How to disable systemd-resolved in Ubuntu

Stages

  • Disable and stop the systemd-resolved service:

      sudo systemctl disable systemd-resolved.service
      sudo systemctl stop systemd-resolved
    
  • Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

@SeanHood
SeanHood / README.md
Last active March 18, 2025 13:29
Vendoring Python dependencies for the lazy

Vendoring Python dependencies for the lazy

Say I've written a script in Python and want to ship the whole thing in a single directory/tarball to a machine without having to polute the system by running pip or yum. This is a way to do that.

# Install deps into a directory called vendor
pip install -r requirements.txt --prefix vendor
@noviluni
noviluni / admin.py
Last active February 4, 2025 12:30 — forked from safar/admin.py
Large Table Paginator for Django: Scale Django admin pages and avoid timeouts.
from django.contrib.admin import ModelAdmin
from .paginator import LargeTablePaginator
class MyTableAdmin(ModelAdmin):
...
paginator = LargeTablePaginator
show_full_result_count = False # Recommended to avoid another count()
...
@roycewilliams
roycewilliams / pwnedpasswords-v2-top20k.txt
Last active January 4, 2025 03:16
pwnedpasswords-v2-top20k.txt
#------------------------------------------------------------------------------
# Top 20K hashes from the Troy Hunt / haveibeenpwned Pwned Passwords list v2 (2018-02-21)
# with frequency count and cracked plaintext passwords
#
# The latest version of this file can be found here:
# https://gist.github.com/roycewilliams/281ce539915a947a23db17137d91aeb7
#
# NOTE: THIS FILE IS DEPRECATED.
# The equivalent of this file, but based on v6 of the Pwned Passwords, is here:
# https://gist.github.com/roycewilliams/226886fd01572964e1431ac8afc999ce
@Ellrion
Ellrion / LaravelUserProcessor.php
Last active February 5, 2019 16:53
Add info about auth user for log in Laravel
<?php
namespace App\Services\Foundation\Log;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
/**