This file contains hidden or 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
| #!/bin/bash | |
| # A backup solution based on rsync with hard links and no deletion of old images | |
| # Deletion would be delegated to a script such as weeder | |
| # https://pypi.org/project/weeder/ | |
| set -euo pipefail | |
| set -x | |
| dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
This file contains hidden or 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 | |
| """Render a view of the k8s status in a namespace. | |
| Example: | |
| # Display the state in console | |
| k8splore.py -n my-ns -c my-cx --format text | |
| # Display the state as a graph, with some nodes omitted. | |
| k8splore.py -n my-ns -c my-cx --drop-kind ReplicaSet Pod Job \\ |
This file contains hidden or 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 | |
| """Emit an hash on stdout of a dockerfile and the files added by it. | |
| - Dockerfile comments don't affect the hash value. | |
| - If a directory is added by dockerfile, only the git-versioned files are | |
| included in the hash. | |
| - A single file hash matches md5sum result. | |
| """ | |
| import os |
This file contains hidden or 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 -u --recursive --new-file v1.1.41/linux/kernel/sched.c linux/kernel/sched.c | |
| --- v1.1.41/linux/kernel/sched.c Wed Aug 3 09:32:33 1994 | |
| +++ linux/kernel/sched.c Tue Aug 9 09:34:45 1994 | |
| @@ -161,7 +161,7 @@ | |
| * information in task[0] is never used. | |
| * | |
| * The "confuse_gcc" goto is used only to get better assembly code.. | |
| - * Djikstra probably hates me. | |
| + * Dijkstra probably hates me. | |
| */ |
This file contains hidden or 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 os | |
| import time | |
| import psycopg2 | |
| from psycopg2 import extensions as ext | |
| def paginate(seq, page_size=100): | |
| page = [] | |
| it = iter(seq) | |
| while 1: |
This file contains hidden or 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
| """ | |
| Test fetching unicode strings for the database. | |
| """ | |
| from __future__ import print_function | |
| from timeit import Timer | |
| def main(): | |
| opt = parse_cmdline() |
This file contains hidden or 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
| """ | |
| An example of named tuple cursor de-duplicating repeated fields names. | |
| This is **not** a good idea: it makes the program unpredictable. But if you put | |
| the foot and really look for a gun... | |
| See https://github.com/psycopg/psycopg2/issues/418 | |
| """ | |
| from itertools import count | |
| from collections import OrderedDict, namedtuple |
This file contains hidden or 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
| # This file specifies all information for a PGXN distribution. Full spec is at | |
| # http://pgxn.org/spec/ *NOTE* A single distribution can contain multiple | |
| # extensions! See http://pgxn.org/spec/#Terminology. | |
| # | |
| # Keys marked REQUIRED or Optional are what you'd expect. Keys marked Unusual | |
| # are keys you don't normally need to use. The pgxntool Makefile will strip | |
| # out empty keys to produce a working META.json, so it's fine to leave them | |
| # here. | |
| # REQUIRED. Name of distribution. |
This file contains hidden or 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 python | |
| """Find pictures rated one star or more and print their file names. | |
| The output can be used e.g. with rsync --files-from | |
| """ | |
| import os | |
| import sys | |
| from glob import glob | |
| from xml.etree import cElementTree as ET |
This file contains hidden or 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 an email about ukulele: | |
| [...], but I have a trick for you. We always refused to | |
| "bless" it into psycopg because it may break in the future (well, it | |
| will only in psycopg3 which is not really on anybody's roadmap, only | |
| on mine if I manage to clone myself at least 4 times). But... | |
| In [5]: class Identifier(str): pass | |
| In [7]: psycopg2.extensions.register_adapter(Identifier, psycopg2.extensions.AsIs) |