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
# Demo of finding the nth permutation of a list in-place in Python >=3.8 | |
# Copyright (c) 2023 Sebastian Pipping <[email protected]> | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
from copy import copy | |
from math import factorial | |
from typing import List | |
from unittest import TestCase, TestLoader, TextTestRunner | |
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
# Copyright (c) 2022 Sebastian Pipping <[email protected]> | |
# Licensed under the Apache license version 2.0 | |
# | |
# Needs Python >=3.6 | |
# Version 2022-02-01 17:50 UTC+1 | |
_full_block_char = '\u2588' | |
_ansi_escape = '\u001b' | |
_ansi_reset = f'{_ansi_escape}[0m' | |
_demo_text = 2 * _full_block_char |
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
# Copyright (c) 2021 Sebastian Pipping <[email protected]> | |
# Licensed under the Apache license version 2.0 | |
# | |
# Creates an XML file with a given number of prefixed XML attributes | |
# on a single XML tag. | |
# Needs Python >=3.6 and PyPI package "base58" | |
# | |
# 2021-12-31 00:47 UTC+1 | |
import argparse |
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
// Copyright (c) 2021 Sebastian Pipping <[email protected]> | |
// Licensed under the Apache license version 2.0 | |
// | |
// Compile and run with: | |
// # gcc -std=gnu99 -Wall -Wextra -pedantic bisect_malloc.c && ./a.out | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> |
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
#! /usr/bin/env python3 | |
# Copyright (C) 2021 Sebastian Pipping <[email protected]> | |
# Licensed under the Apache 2.0 License | |
# Version 2021-08-19 00:51 UTC+2 | |
import argparse | |
from typing import List | |
import chess | |
import chess.pgn # https://python-chess.readthedocs.io/en/latest/pgn.html |
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
diff --git a/Makefile.am b/Makefile.am | |
index 0d7257f..a3f948e 100644 | |
--- a/Makefile.am | |
+++ b/Makefile.am | |
@@ -1,5 +1,5 @@ | |
## Process this file with automake to produce Makefile.in | |
-AUTOMAKE_OPTIONS = 1.10.1 gnu dist-zip dist-bzip2 dist-lzma subdir-objects | |
+AUTOMAKE_OPTIONS = 1.10.1 foreign dist-zip dist-bzip2 subdir-objects | |
ACLOCAL_AMFLAGS = -I m4 |
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
decode-jwt-token() { python3 -c 'import sys, json, base64; [print(json.dumps(json.loads(base64.urlsafe_b64decode(e + (len(e)%3)*"=")), indent=2)) for e in sys.argv[1].split(".")[:2]]' "$1"; } |
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
exclude: ^myDjangoApp/static/ | |
repos: | |
- repo: https://github.com/asottile/pyupgrade | |
rev: v1.11.0 | |
hooks: | |
- id: pyupgrade | |
- repo: https://github.com/pre-commit/mirrors-autopep8 | |
rev: v1.4.3 |
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
# Django management command to create custom superusers | |
# Version 2018.03.18 | |
# | |
# Core benefits over existing command `createsuperuser` are: | |
# - Scriptability | |
# - Ignorance of `settings.AUTH_PASSWORD_VALIDATORS` | |
# - Idempotency | |
# | |
# Store as `<app>/management/commands/createcustomsuperuser.py` to activate. | |
# Originally written for Django 1.9.9. |
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
#! /usr/bin/env python2 | |
# Copyright (C) 2016 Sebastian Pipping <[email protected]> | |
# Licensed under AGPL v3 or later | |
from __future__ import print_function | |
import argparse | |
import errno | |
import os | |
import re |