Skip to content

Instantly share code, notes, and snippets.

View gjoseph92's full-sized avatar

Gabe Joseph gjoseph92

View GitHub Profile
@gjoseph92
gjoseph92 / lp2844-macos-notes.md
Last active November 28, 2023 17:32
Notes on printing better quality labels using LPrint

The built-in driver for the Zebra LP2844 on macOS ("Zebra EPL2 Label Printer", see https://youtu.be/DT6gnpzzU60) gives pretty crappy print quality.

The latest (unreleased, as of Aug 2023) version of LPrint does better, see michaelrsweet/lprint#91 (comment).

I think the new "special algorithm" doesn't actually do much. It may just be that print-color-mode=bi-level, aka Print Mode: Text (which thresholds the image instead of trying to use dithering to cover the whole grayscale range) wasn't actually working in 1.2.0, and all the changes with the new algorithm accidentally fixed that bug. I see no visible difference between bi-level and monochrome; monochrome should, in theory, be thresholding only the parts that "look like a barcode", leaving the other parts dithered like before, whereas bi-level should be thresholding the whole thing.

This file has been truncated, but you can view the full file.
{"$schema":"https://www.speedscope.app/file-format-schema.json","profiles":[{"type":"sampled","name":"Process 75 Thread 100 \"\"","unit":"seconds","startValue":0.0,"endValue":28.09,"samples":[[7,6,525,524,523,522,509,67],[7,6,525,524,523,522,509,67],[7,6,525,524,523,522,509,508,507,506,505,504,269,268,267,266,265,264,263,262],[7,6,525,524,523,522,509,508,507,506,505,504,269,268,267,266,265,264,263,262],[7,6,525,524,523,522,509,508,507,506,505,504,269,268,267,266,265,264,263,262],[7,6,525,524,523,522,509,508,507,506,505,504,269,268,267,266,265,264,263,262],[7,6,525,524,523,522,509,508,507,506,505,504,269,268,267,266,265,264,263,262],[7,6,525,524,523,522,509,508,507,506,505,504,269,268,267,266,265,264,263,262],[7,6,525,524,523,522,509,508,507,506,505,504,269,268,267,266,265,264,263,262],[7,6,525,524,523,522,509,508,507,506,505,504,269,268,267,266,265,264,263,262],[7,6,525,524,523,522,509,508,507,506,505,504,269,268,267,266,265,264,263,262],[7,6,525,524,523,522,509,508,507,506,505,504,269,268,267,266,265,264,263
@gjoseph92
gjoseph92 / README.md
Last active June 6, 2023 13:25
Share speedscope profiles in GitHub issues

An easy way to share speedscope profiles in GitHub issues

Speedscope is an excellent profile viewer. Maybe you're recorded a profile with py-spy and you want to show it to other people in a GitHub issue. The speedscope app can render profiles from a URL, but where do you store the profile?

You can do this easily with gists, githack, and a little script:

Installation:

@gjoseph92
gjoseph92 / extract.py
Created June 1, 2021 19:32
Extract pixel values from xarray at coordinates given in a dask DataFrame
"""
Extract pixel values from a dask-backed DataArray/Dataset at x, y coordinates given in a dask DataFrame.
See the ``pixel_values_at_points`` docstring for usage.
Example
-------
>>> import dask
>>> import xarray as xr
>>> data = xr.DataArray(
@gjoseph92
gjoseph92 / install-qgis-macos.md
Last active September 8, 2018 22:27
macOS: install QGIS 3 without trashing your python/dev environment

Installing QGIS 3.2 on macOS for the paranoid

So you have your development environment carefully set up, with pyenv or conda to manage multiple versions of Python and multiple virtual environments for different projects, and just the right version of GDAL installed, and you can even import gdal without everything blowing up.

You want QGIS, but you don't want to ruin this careful tower of babel and be left unable to build anything with GDAL dependencies or run the right Python versions.

Turns out, using the packaged installers for QGIS will work just fine—because they install everything as macOS frameworks, which won't interact with the rest of your environment.

Steps: