Skip to content

Instantly share code, notes, and snippets.

View fish2000's full-sized avatar
👉
MINUTE CONCERN, EXTRAORDINARY CONFLAGRATION

Alexander Böhn fish2000

👉
MINUTE CONCERN, EXTRAORDINARY CONFLAGRATION
  • Objects in Space and Time, LLC
  • Baltimore, MD
  • X @fish2000
View GitHub Profile
@fish2000
fish2000 / display.py
Created April 24, 2019 20:35
Decorator to simplify setting display-related attributes in Django ModelAdmin subclasses
# encoding: utf-8
class display(object):
""" A decorator to make short work of using custom display/format methods
in Django ModelAdmin subclasses -- they'd have you do shit like this:
class DoggAdmin(ModelAdmin):
list_display = ['id', 'with_name']
def with_name(self, obj):
@fish2000
fish2000 / csvpadding.py
Last active August 15, 2019 16:36
CSV data padding
# encoding: utf-8
# Usage: `pad_csv(«uneven CSV data»)` -> «padded CSV data»
try:
from functools import reduce
except ImportError:
pass
segments = lambda line: len(line.split(','))
@fish2000
fish2000 / brew-receipt.sh
Last active June 3, 2022 02:55
Homebrew external-command script to show syntax-highlited install receipt JSON, using Pygments
#!/usr/bin/env bash
#: * `receipt` <formula> [<formula>...]:
#: Show the syntax-highlighted JSON install receipt for the specified formulae
function brew () {
"${HOMEBREW_PREFIX}/bin/brew" "$@"
}
irfilename="INSTALL_RECEIPT.json"
pygmentize="$(command -v pygmentize)"
@fish2000
fish2000 / keyvalue.py
Last active May 10, 2019 01:29
Generic Python REPL configuration NOW WITH ANSI-COLOR FIGLET BANNERS DOGG
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import plistlib
import zict
import os
import appdirs
from replutilities import attr, isstring, isbytes
@fish2000
fish2000 / .bash_prompt.sh
Last active January 30, 2019 07:40 — forked from miki725/.bash_prompt.sh
Custom bash prompt display: «virtualenv»:HOST-NAME:current_working_dir[git-branch •]$
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch of the current git/mercurial repository
# * the return value of the previous command
#
# USAGE:
@fish2000
fish2000 / cieXYZ.py
Created January 30, 2019 05:07
Coordinates for drawing the CIE1931 XYZ colorspace from above (née “Yxy”)
#!/usr/bin/env python
# encoding: utf-8
"""
cieXYZ.py
Party like it's 1931.
Created by FI$H 2000 on 2011-04-18.
Copyright (c) 2011 OST, LLC. All rights reserved.
@fish2000
fish2000 / # cpplocate - 2019-01-26_04-28-08.txt
Created January 26, 2019 09:35
cpplocate (cginternals/cginternals/cpplocate) on macOS 10.14.3 - Homebrew build logs
Homebrew build logs for cginternals/cginternals/cpplocate on macOS 10.14.3
Build date: 2019-01-26 04:28:08
@fish2000
fish2000 / # cppassist - 2019-01-26_04-26-36.txt
Created January 26, 2019 09:31
cppassist (cginternals/cginternals/cppassist) on macOS 10.14.3 - Homebrew build logs
Homebrew build logs for cginternals/cginternals/cppassist on macOS 10.14.3
Build date: 2019-01-26 04:26:36
@fish2000
fish2000 / pillow-inplace-manual-build.sh
Last active January 25, 2019 20:12
How to build Pillow’s extensions in-place for testing
CFLAGS="-I$(brew --prefix zlib)/include -I$(brew --prefix jpeg)/include -I$(brew --prefix openjpeg)/include -I$(brew --prefix webp)/include -I$(brew --prefix lcms2)/include -I$(brew --prefix libtiff)/include -I$(brew --prefix freetype)/include -I$(brew --prefix libimagequant)/include" python ./setup.py build_ext --inplace --enable-zlib --enable-jpeg --enable-tiff --enable-freetype --enable-lcms --enable-webp --enable-webpmux --enable-jpeg2000 --enable-imagequant
@fish2000
fish2000 / original-photoshop-acv-reader.py
Created December 25, 2018 12:11
Original Photoshop ACV File Reader Python Code from (Now-Defunct) WeemoApps.com
#!/usr/bin/env python
"""
DESCRIPTION
Prints the polynomials that describe a photoshop curve.
There are three curves (one per RGB channel) which you can later
use to make a custom filter for your image.
See http://www.weemoapps.com/creating-retro-and-analog-image-filters-in-mobile-apps
for the theory behind this method.