This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- debug: | |
msg: '{{ last|default("") }} -> {{ item }}' | |
- set_fact: | |
last: '{{ item }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
connection: local | |
gather_facts: no | |
vars: | |
mylist: | |
- a | |
- b | |
- c | |
tasks: | |
- debug: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy | |
import pytest | |
from django.contrib.auth.models import User | |
users = [ | |
User(username="a"), | |
User(username="b"), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
import base64 | |
import itertools | |
import random | |
from dataclasses import dataclass | |
from functools import cached_property | |
from math import ceil, floor, log2, log10 | |
from django.db import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="{% static 'app.js' %}" data-csrftoken="{{ csrf_token }}"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime as dt | |
import subprocess | |
from colorsys import hsv_to_rgb | |
from textwrap import dedent | |
from django.core.management.base import BaseCommand | |
from django.db import DEFAULT_DB_ALIAS, connections | |
from django.db.migrations.loader import MigrationLoader | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<opml version="1.1"> | |
<head> | |
<title>Adam Johnson's AWS Old Reader Category</title> | |
<dateCreated>Tue, 01 Dec 2020 12:13:15 GMT</dateCreated> | |
<dateModified>Tue, 01 Dec 2020 12:13:15 GMT</dateModified> | |
<ownerName>me@adamj.eu</ownerName> | |
<ownerEmail>me@adamj.eu</ownerEmail> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GitHub Squash and Merge PR fixer | |
// @namespace https://github.com/ | |
// @version 1.0 | |
// @description try to take over the world! | |
// @author Adam Johnson | |
// @match https://github.com/* | |
// @grant all | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Implements the algorithm at https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html | |
""" | |
import hmac | |
import hashlib | |
import base64 | |
def ses_hash(secret_access_key): | |
message = "SendRawEmail" |