- 2025-04-28
- Linux Mint 22.1, Cinnamon v6.4.8
cinnamon-settings keyboard will not let me remap Alt+Print to a better screenshot tool. Let's figure out why.
| #!/bin/bash | |
| STRFTIME="%Y-%m-%d %H-%M-%S %3N" # 2025-01-01 13:01:01 001 | |
| DIR="$HOME/Pictures/Screenshots" | |
| EXTNAME="jpg" | |
| FILENAME="$DIR/$(date +"$STRFTIME").$EXTNAME" | |
| # echo "$FILENAME" | |
| mkdir -p "$DIR" |
| # Extends Pathname to add #stemname instance method | |
| class Pathname | |
| # "dir/subdir/filename1.ext" => "filename1" | |
| def stemname | |
| bs = basename.to_s | |
| bs.slice(0,bs.length-extname.length) | |
| end | |
| end |
| require 'fileutils' | |
| # For use in cleaning scanned book/magazine/etc pages and preparing the scans | |
| # for distribution/OCR. | |
| # | |
| # Assume you've been scanning a book as double-page scans. You can | |
| # automatically split them into two files via ImageMagick `mogrify`: | |
| # | |
| # mogrify -path "./Auto-Halved Pages" -format png -crop 50%x100% +repage "./Double-Page Scans/*.png" | |
| # |
| --- | |
| :subscripts: | |
| "₀": '0' | |
| "₁": '1' | |
| "₂": '2' | |
| "₃": '3' | |
| "₄": '4' | |
| "₅": '5' | |
| "₆": '6' | |
| "₇": '7' |
| Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em#i_vs._em | |
| <i> vs. <em> | |
| Some developers may be confused by how multiple elements seemingly produce similar visual results. <em> and <i> are a common example, since they both italicize text. What's the difference? Which should you use? | |
| By default, the visual result is the same. However, the semantic meaning is different. The <em> element represents stress emphasis of its contents, while the <i> element represents text that is set off from the normal prose, such as a foreign word, fictional character thoughts, or when the text refers to the definition of a word instead of representing its semantic meaning. (The title of a work, such as the name of a book or movie, should use <cite>.) | |
| This means the right one to use depends on the situation. Neither is for purely decorative purposes, that's what CSS styling is for. |
This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.
ghostscript -r72 -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -dCompressFonts=true -sOutputFile=output.pdf input.pdf
Change -r for the resolution.
Other options for PDFSETTINGS:
| require 'csv' | |
| def hash_array_to_csv(hash_arr, fname='csv.csv') | |
| headers = hash_arr.map{|hsh| hsh.keys}.flatten.uniq | |
| csv = CSV.generate do |csv| | |
| csv << headers | |
| hash_arr.each do |hsh| | |
| csv << (headers.map{|k| hsh[k]}) | |
| end | |
| end |