$ uname -a
Linux x220 6.3.0-1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.3.7-1 (2023-06-12) x86_64 GNU/Linux
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 | |
set -euo pipefail | |
# Find files created within 1 days (`-ctime -1`); | |
# convert (Nikon/NEF) RAW images to PPM using dcraw; | |
# write results to stdout with -c; | |
# convert stdin to JPG using Imagemagick's convert; | |
# specify format of input image with 'ppm:-'. | |
find /path/to/sdcard/ -name '*.NEF' -ctime -1 \ |
From: https://cromwell-intl.com/open-source/performance-tuning/file-systems.html.
Disable recording of access times when mounting the FS.
For example, find
with access times enabled would upate the access time of every file found.
# /etc/fstab
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
# Oh-My-ZSH custom function to record left monitor from CLI. | |
# | |
# Place in $ZSH/.oh-my-zsh/custom. | |
# | |
# Two monitors at screen 0, the left one connected at DP-1: | |
# | |
# xrandr | |
# Screen 0: minimum 320 x 200, current 3840 x 1200, maximum 16384 x 16384 | |
# DP-1 connected primary 1920x1200+1920+0 (normal left inverted right x axis y axis) 518mm x 324mm | |
# 1920x1200 59.95*+ |
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
# Place in $ZSH/.oh-my-zsh/custom. | |
# | |
# The following ZSH function uses GhostScript's `gs` command to reduce the file size of a PDF file. | |
# The result of compressing `test.pdf` will be written to `test.compressed.pdf`. | |
# If `test.compressed.pdf` exists, it will only be overwritten after confirmation. | |
# | |
# Now, restart/open a new shell and compress PDFs with: | |
# | |
# compress_pdf test.pdf | |
# File exists: test.compressed.pdf, overwrite (Y/n)? |
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
# Based on https://apple.stackexchange.com/a/389067/453491 | |
# In order to calculate DPI, determine units and resolution first. | |
identify -verbose warc2corpus@2x_300dpi.png | grep -E -i "resolution|units" | |
# Resolution: 118.11x118.11 | |
# Units: PixelsPerCentimeter | |
# png:pHYs: x_res=11811, y_res=11811, units=1 | |
# 1 PixelsPerCentimeter corresponds to 2.54 DPI. | |
# Calculate DPI using the following command. |
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
class Heap | |
def initialize(*elems) | |
@h= heapify(elems) | |
end | |
def inspect | |
return '(empty)' if @h.empty? | |
@h | |
.group_by.with_index{ Math.log2(_2+1).to_i } | |
.map{ |l,vs| vs.join(' ') } | |
.join("\n") |
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 | |
# Options to -draw are not well documented; | |
# see: https://www.imagemagick.org/Usage/fonts/ | |
set -euo pipefail | |
IFS=$'\n\t' | |
indir="/media/sebastian/3161-3938/DCIM" |
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
# For each page in input.pdf, | |
# generate image(s) in PNG format | |
# named output_<PAGE>.png | |
# where PAGE is a 4-digit zero-padded number. | |
pdfinfo input.pdf \ | |
| grep Pages \ | |
| awk -F'[: ]*' '{print $2}' \ | |
| xargs seq \ | |
| parallel \ | |
'\ |
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
1. Download and install the official PPD files | |
See https://www.konicaminolta.de/de-de/support/download-center | |
Latest version at time of writting is `BH554ePPDLinux_300000000MU.zip` | |
2. Find out printer's IP address | |
On the printer, press |