Skip to content

Instantly share code, notes, and snippets.

View dharple's full-sized avatar

Doug Harple dharple

View GitHub Profile
@dharple
dharple / nautilus.md
Last active April 26, 2024 03:29
Make Nautilus Icons Bigger

This unlocks one additional zoom level after the standard 133%. It's huge, but it's better for picture sorting.

Warning: this breaks the ability to click and drag a file from one window to another. It also makes every icon a large square, so that there is no actual empty space between the icons.

gsettings set org.gnome.nautilus.preferences use-experimental-views true

This works in GNOME 42 (Ubuntu 22.04).

@dharple
dharple / long-password.php
Last active March 18, 2021 19:45
Examine PHP Password Hashing Algorithms
<?php
// $source = 'http://www.gutenberg.org/cache/epub/1/pg1.txt';
// $source = '/usr/lib/python3/dist-packages/diceware/wordlists/wordlist_en.txt';
$source = '/usr/share/dict/web2';
// $algorithm = PASSWORD_BCRYPT;
// $algorithm = PASSWORD_DEFAULT;
$algorithm = PASSWORD_ARGON2ID;
@dharple
dharple / post-main-fix.md
Last active February 11, 2023 13:48
Switch checkout from master to main

After renaming master to main on GitHub, run:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
git fetch --prune
@dharple
dharple / calculate-hash-speed.php
Last active March 18, 2021 19:54
Quick script to compare hash calculation times
<?php
//
// Quick script to compare hash calculation times
//
$hashTotals = [];
foreach (hash_algos() as $algorithm) {
$hashTotals[$algorithm] = 0.0;
}
@dharple
dharple / remove-virus-from-mbox.md
Last active March 18, 2021 19:56
This describes a process for removing a single infected email from an mbox file.

Prerequisites:

  • clamscan
  • php-cli
  • wget

Set up a work directory and bring in the affected mbox.

mkdir lab
cd lab
@dharple
dharple / enscript-simple.sh
Created May 25, 2020 22:03
Convert text file to landscape/2 column PDF
#!/bin/sh
# requires enscript and ghostscript
enscript -2 -r in.txt -o out.ps
ps2pdf out.ps out.pdf
@dharple
dharple / dump_csv.php
Created January 7, 2020 21:51
Dump Embedded CSV Files out of a PDF
<?php
// composer require smalot/pdfparser
// quick script to dump embedded CSV files out of a PDF
include 'vendor/autoload.php';
$file = 'document.pdf';
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile($file);
<?php
/**
* Array to Text Table Generation Class
*
* @author Tony Landis <tony@tonylandis.com>
* @author dharple
* @link http://www.tonylandis.com/
* @copyright Copyright (C) 2006-2009 Tony Landis
* @license http://www.opensource.org/licenses/bsd-license.php
*/