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
  • 11:27 (UTC -04:00)
  • X @fish2000
View GitHub Profile
@JEFworks
JEFworks / dither.R
Last active October 18, 2024 17:23
A fast Floyd-Steinberg dithering filter in C++ using Rcpp
library(Rcpp)
#' Floyd-Steinberg dithering
#'
#' @description Rcpp C++ function for Floyd-Steinberg dithering
#' More info: https://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering
#' Note, this is a C++ translation of the FloydConvolution function by Todos Logos
#' from https://www.r-bloggers.com/r-is-a-cool-image-editor-2-dithering-algorithms/
#'
#' @param x Greyscaled 2D image matrix
class Dogg
let name: String
var _did_you_hear: Bool
var _prefix_yos: U64
new ref create(name': String,
trait T1
trait T2
interface I3
interface I4
type UnionTraits is (T1 | T2)
type UnionInterfaces is (I3 | I4)
type IntersectTraits is (T1 & T2)
type IntersectInterfaces is (I3 & I4)
@tobiasgoecke
tobiasgoecke / chrome_headless_screenshot.py
Created March 1, 2018 20:04 — forked from rverton/chrome_headless_screenshot.py
Make a screenshot with a headless google chrome in python
# Install chromedriver from https://sites.google.com/a/chromium.org/chromedriver/downloads
import os
from optparse import OptionParser
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
CHROME_PATH = '/usr/bin/google-chrome'
@dubslow
dubslow / custom_inheritor.py
Last active December 15, 2019 16:53
Python recipe to "automatically delegate method calls to a proxy attribute", aka "customized inheritance"
# Following class and decorator totally jacked from Jacob Zimmerman, with a few tweaks/renames
# https://programmingideaswithjake.wordpress.com/2015/05/23/python-decorator-for-simplifying-delegate-pattern/
# (I couldn't get the default copying of the entire baseclass dict to work, because that delegates __new__,
# which chokes on the non-subclass subclass. So just remove it for now)
# What this does: allows you to "subclass" an arbitrary baseclass by delegating certain methods/fields on
# your 'subclass' to the delegate-attribute without boilerplate for each individual method/field
# Equally valid interpretation of the same semantics: "subclass" a baseclass, but allows you to exclude
# certain methods from being used on the "subclass".
# Possible use cases include: making a read-only/immutable "subclass" of the builtin/superspeed dict
@fish2000
fish2000 / asscat.py
Last active May 10, 2019 01:23
Pillow-based asset catalog image-scaler CLT
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# asscat.py
#
# Generate a properly scaled 1x/2x/3x set of PNGs, optionally with
# generated JSON metadata and/or subfolders, for each single given image.
# For use with, like, all those Xcode asset catalogs and shit.
# Requires the Pillow and docopt modules; optionally makes use of six.
#
@mattrohland
mattrohland / semvercli.py
Created July 3, 2017 23:13
Semantic Versioning CLI powered by the "semver" semantic versioning package and the "docopt" command line interface package.
"""Semantic Versioning CLI (0.1.0)
Usage:
semvercli.py compare <a> <b>
semvercli.py bump_major <a>
semvercli.py bump_minor <a>
semvercli.py bump_patch <a>
semvercli.py (-h | --help)
semvercli.py --version
#!/bin/bash
# The MIT License (MIT)
# Copyright (c) 2013 Alvin Abad
if [ $# -eq 0 ]; then
echo "Git wrapper script that can specify an ssh-key file
Usage:
git.sh -i ssh-key-file git-command
"
#include <bits/stdc++.h>
using namespace std ;
/* When Panda is Life !
_,add8ba,
,d888888888b,
d8888888888888b _,ad8ba,_
d888888888888888) ,d888888888b,
I8888888888888888 _________ ,8888888888888b
__________`Y88888888888888P"""""""""""baaa,__ ,888888888888888,
encoding = UTF-8
fontName = "Menlo"
fontSize = 14
lineEndings = '\n'
showInvisibles = false
softWrap = true
tabSize = 2
fileBrowserGlob = "{*,.tm_properties,.htaccess,.gitignore,.jshintrc,.eslintrc,.babelrc}"
include = "{$include,.tm_properties,.htaccess,.gitignore,.jshintrc,.eslintrc,.babelrc}"