Skip to content

Instantly share code, notes, and snippets.

View fish2000's full-sized avatar
👉
My Python work is on the Mars helicopter, and ubiquitous on earth, and more!!!!

Alexander Böhn fish2000

👉
My Python work is on the Mars helicopter, and ubiquitous on earth, and more!!!!
  • Objects in Space and Time, LLC
  • Baltimore, MD
  • 04:50 (UTC -04:00)
  • X @fish2000
View GitHub Profile
@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.
@fish2000
fish2000 / floyd-steinberg-dither-test.py
Created December 17, 2018 20:08
TESTING FLOYD AND STEINBERG’S WAYS OF DITHER
from instakit.processors.halftone import FloydSteinberg
import glob, os, sys
from PIL import Image
floydster = FloydSteinberg()
jpgs = glob.glob("/Users/fish/Documents/YO_DOGG/HOLZER/*.jpg")
images = [Image.open(impath) for impath in jpgs]
processed = [floydster.process(im) for im in images]
for p in processed: p.show()
@fish2000
fish2000 / rejar.py
Created December 17, 2018 20:01
Python CLT for injecting modified locality-sensitive hash data into Java JAR files
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import zipfile
import tempfile
import pylire
import shutil
import sys
@fish2000
fish2000 / pycheckmate.py
Last active December 5, 2018 17:53
Overhaul of PyCheckMate.py for Python 3.7 circa late 2018
#!/usr/bin/env python
# encoding: utf-8
#
# PyCheckMate, a PyChecker output beautifier for TextMate.
# Copyright (c) Jay Soffian, 2005. <jay at soffian dot org>
# Inspired by Domenico Carbotta's PyMate.
# Extensively overhauled for version 2.0 by Alexander Böhn.
#
# License: Artistic.
#
@fish2000
fish2000 / multiple_dispatch.py
Last active November 20, 2018 20:25 — forked from wolfv/multiple_dispatch.py
A Taste Of Julia / C++ in Python – simple Python multiple dispatch from type hints
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# multiple_dispatch.py
#
# My version:
# https://gist.github.com/fish2000/1af4b852d20b7568a9b9c90fe2346b6d
#
# Forked from the originall by @wolfv:
# https://gist.github.com/wolfv/73f56e4a9cac84eea6a796fde3213456
@fish2000
fish2000 / brew-show.sh
Last active June 3, 2022 02:54
Homebrew external-command script to show syntax-highlited formulae, using Pygments
#!/usr/bin/env bash
#: * `show` <formula> [<formula>...]:
#: Show the syntax-highlighted source of the specified formulae
function brew() {
"${HOMEBREW_PREFIX}/bin/brew" "$@"
}
pygmentize="$(which pygmentize)"
@fish2000
fish2000 / numpy-with-pythran-HEAD-failure.log
Created October 23, 2018 12:03
Installing numpy with `brew reinstall numpy --HEAD` fails if `pythran` is installed
PIPER-ALPHA:tmp$ brew install numpy --HEAD
Checking if we need to fetch /usr/local/Homebrew...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/fish2000/homebrew-praxa...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-completions...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-dupes...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-nginx...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-php...
@fish2000
fish2000 / cython-compiler-errors.log
Created October 16, 2018 12:05
Cython compiler error output when trying to build a project with nested `cimport` statements and `language_level=3`
PIPER-ALPHA:language_level[language_level_3]$ ./rebuild
+++ dirname ./rebuild
++ cd .
++ pwd
+ : /tmp/language_level
++ dirname /tmp/language_level
+ : /tmp
+ rm -rf /tmp/language_level/build
+ rm -rf /tmp/language_level/mypackage/__pycache__/
+ rm -f /tmp/language_level/mypackage/mycymod.cpp
@fish2000
fish2000 / pyls-function.bash
Created April 24, 2018 00:16
Bash 4.0+ function using Pythonpy
function pyls() {
if [ "$1" ]; then
attribute_count=$(py "len(dir(${1}))")
item_count=$(py "getattr(${1}, '__len__', lambda *a, **k: 0)()")
what_is_it=$(py "type(${1}).__name__")
echo -n "> Python ${what_is_it} “${1}” has ${item_count} member sub-items"
[ "${item_count}" -eq "0" ] && echo "" || echo ":"
# py ${1} | py -x '"+ %s" % x' -c 'print("")'
py ${1} | py -x '"+ %s" % x'
echo -n "> Python ${what_is_it} “${1}” has ${attribute_count} member attributes"