Skip to content

Instantly share code, notes, and snippets.

@cmcginty
cmcginty / badblocks.md
Last active August 5, 2021 04:45
Hard Drive Integrity Tests with Badblocks Command

Before installing a new hard drive, use the following steps to detect any IMF issues.

  1. Install badblocks tool.
brew install e2fsprogs
brew ln --force e2fsprogs
@cmcginty
cmcginty / zip_cookbook.md
Last active October 5, 2020 03:14
Zip and 7z Cookbook

List all ZIP files and their uncompressed size in a dir

find "$(pwd)" -name *.zip | while read -r; do 
  echo -n "$REPLY\t"; 
  unzip -l $REPLY | tail -1 | awk '{print $1}'; 
done

List all 7z files and their uncompressed size in a dir

@cmcginty
cmcginty / versionbump.py
Last active August 12, 2017 07:26
Command-line tool for automated software version numbering.
import sys
import click
MIN_DIGITS = 2
MAX_DIGITS = 3
@click.command()
@click.argument('version')
@cmcginty
cmcginty / logitech_keymap.md
Created April 29, 2017 09:41
Logitech Keyboard Mappings
if [ -n "${DISPLAY+x}" ]; then
  xmodmap -e "keycode 62 = Up"
  xmodmap -e "keycode 111 = Shift_R"
  xmodmap -e "add shift = Shift_R"
  xset r 62
  xset -r 111
  xmodmap -e "keycode 66 = Control_L"
  xmodmap -e "clear Lock"
 xmodmap -e "add Control = Control_L"
@cmcginty
cmcginty / linux_retro_gaming.md
Last active February 27, 2024 12:54
How to build a retro-gaming box with ChromeBox + Lubuntu + Retroarch

Retro-Gaming Box (Chromebox + Lubuntu + Retroarch)

A basic guide on how to setup a Chromebox running Retroarch as a retro-gaming living room device.

Chromebox Retro

Table of Contents

@cmcginty
cmcginty / enable-mythweb-direct-download.md
Last active December 16, 2016 08:55
Enable Mythweb Direct Download Links on Ubuntu

Enable Mythweb Direct Download Links on Ubuntu

"The requested URL /mythweb/mythweb.pl/pl/stream/2199/1399343400 was not found on this server."

Requesting just /mythweb/mythweb.pl would download the PERL script, indicating that CGI wasn't working. To get it working, I needed to make the following changes:

  1. sudo ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/cgi.load
  2. In /etc/apache2/mods-available/mime.conf, add:

AddHandler cgi-script .cgi .pl

@cmcginty
cmcginty / keypass-setup-and-sync.md
Last active April 26, 2024 17:59
KeePass2 Password Manager Settings and Auto-Synchronization

KeePass2 Setup and Auto-Synchronization Guide

KeePass is a password management utility for Windows, Linux, and Mac.

The first section describes the steps needed to setup KeyPass2 in Linux and how to add FireFox and Chrome plugin integrations.

The (optional) second section documents a robust way to automatically synchronize the password DB across multiple devices.

Keybase proof

I hereby claim:

  • I am cmcginty on github.
  • I am cmcginty (https://keybase.io/cmcginty) on keybase.
  • I have a public key whose fingerprint is CDEB 856B FAB2 2C72 CE62 3BB1 BA02 2962 0046 D260

To claim this, I am signing this object:

@cmcginty
cmcginty / p4-trigger-style-check.md
Last active September 21, 2021 23:12
Perforce Python trigger to reject unmodified files and new code with TAB indents (instead of spaces).

This is a working example of a Perforce submit-change trigger that can run checks on new files and new or modified lines of code.

Tested on Python2 in Linux and Windows. It does not require the P4Python API, which would probably be a little cleaner, but makes it less portable.

The install instructions are below in the Python file. Before using, the hard-coded P4 user value builds must be created on your server, or changed to a valid user. To prevent having to set the user password in the script, the builds user must be part of a group with the Timeout field set to unlimited to allow for the user to remain logged in on the server.

@cmcginty
cmcginty / gradle-deployment-descriptor-ear-plugin.md
Last active August 29, 2015 14:20
Gradle DeploymentDescriptor EAR Plugin

Gradle DeploymentDescriptor EAR Plugin

Use this Gradle plugin to directly access the DeploymentDescriptor class internal to the EAR plugin.

// custom Gradle task for creating EAR deployment descriptors (i.e. application.xml)
// author: cmcginty@akimeka.com
import org.gradle.api.*
import org.gradle.api.file.*
import org.gradle.api.tasks.*