Skip to content

Instantly share code, notes, and snippets.

View troyfontaine's full-sized avatar

Troy Fontaine troyfontaine

View GitHub Profile
@troyfontaine
troyfontaine / readme.md
Last active September 17, 2024 19:33
Resize root partition (or how to remove the default /home partition) on CentOS 7 online

Resize root partition (or how to remove the default /home partition) on CentOS 7 online

This process requires that you are able to ssh OR log in locally using the root user account and that no services be running as users out of /home on the target machine.

The examples are from a default installation with no customization-you NEED to know what you're working with for volumes/partitions to not horribly break things.

By default, CentOS 7 uses XFS for the file system and Logical Volume Manager (LVM), creating 3 partitions: /,/home and swap.

NOTE: If you want to be sure that nothing is writing to /home you can either modify the host to boot into single-user mode OR try to use the systemctl isolate runlevel1.target command to switch (not tested! should work).

@troyfontaine
troyfontaine / 1-setup.md
Last active September 17, 2024 18:33
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@troyfontaine
troyfontaine / asus-falchion-nx-key-combinations.md
Last active August 27, 2024 08:54
ASUS Falchion NX Key Combinations

ASUS Falchion NX Key Combinations

Function Keys

Hot Key Function
FN + DEL Scroll Lock
FN + CTRL Menu
FN + P Print screen
FN + PgDn End
@troyfontaine
troyfontaine / README.md
Created August 22, 2024 14:21
HP iLO4 On Ubuntu Noble 24.04 for use with HP ProLiant 8th Gen Servers

HP iLO4 on Ubuntu Noble 24.04 for use with HP ProLiant 8th Gen Servers

If you're a homelabber and are interested in attempting to use the iLO4's agentless management functionality (how is it agentless if you have to install software on the OS?), you can do so by installing the HP AMS Package

Install the Agentless Management Service

sudo su -
wget https://downloads.linux.hpe.com/SDR/repo/mcp/pool/non-free/hp-ams_2.8.3-3056.1ubuntu16_amd64.deb
dpkg -i hp-ams_2.8.3-3056.1ubuntu16_amd64.deb
@troyfontaine
troyfontaine / README.md
Last active July 15, 2024 19:16
How to Update the Firmware of a Crucial Consumer SSD on Linux via the Terminal

How to Update the Firmware of a Crucial Consumer SSD on Ubuntu 22.04 via the Terminal

This has been tested on Ubuntu 22.04 with 3x Crucial MX500 1TB SSDs purchased in 2023

  1. Install the required packages
    sudo apt-get install -y smartmontools unzip curl
    
  2. Check your current firmware version and note it-you will want to be sure that you are actually updating the firmware version (replace sdX with your actual device's identifier-leaving off any partition numbers as you're checking the block device and not the data on it)
@troyfontaine
troyfontaine / google-authenticator.md
Last active June 5, 2024 18:41
Getting Google Authenticator working on Ubuntu for SSH Authentication

Google Authenticator for SSH How-To

Installing the Google Authenticator pam package alone does not configure a system for 2 Factor Authentication when connecting via SSH.

Overview

The Google Authenticator package can be installed on Ubuntu via apt-get on Ubuntu 14.04.3 and later (that I've confirmed).

It provides a pam module that allows you to prompt a user for a code generated via a Google Authenticator app or other compatible TOTP app (such as 1Password). The script below enables the authenticator prompt when using ssh and password authentication.

A few things to keep in mind:

  • You cannot enable Google Authenticator for Public Key-based authentication at the same time as Password-based authentication
@troyfontaine
troyfontaine / 1. Windows.md
Last active June 5, 2024 18:30 — forked from igorkulman/CompareTools.plist
Visual Studio Code as a merge tool for Git Tower.

Enable Visual Studio Code for Merge/Diff on Windows

From PowerShell or CMD:

cd C:\Program Files (x86)\fournova\Tower\CompareTools
code .

Edit VisualStudioCode.json and replace line 10 which is:

@troyfontaine
troyfontaine / README.md
Last active May 20, 2024 12:54
Running Badblocks on External USB Drives attached to a TrueNAS Scale Machine

Badblocks on TrueNAS Scale

  1. Connect your USB drive to the machine
  2. Navigate to the TrueNAS Scale shell by opening the menu, going to System Settings and then clicking on Shell
  3. Locate the drive's device ID using the lsblk command
  4. Check the recommended block size using the command blockdev --getbsz /dev/<YOUR BLOCK DEVICE ID>
  5. Note the block size you got from the last command
  6. STOP! Have you ensured that the USB device does NOT have any important data on it? If it does, stop now, unplug it from the TrueNAS Scale machine and back it up elsewhere! Running the specific badblocks command we'll use will destroy data on the drive!
  7. Okay, you've confirmed there is no data on the drive you need? Good!
  8. Fire up a new tmux session tmux new -s badblocks_
@troyfontaine
troyfontaine / PythonAndPowerShell.md
Last active March 4, 2024 14:20
Setting up Aliases for Python on Windows PowerShell

Getting Your Python (Development) On!

Python for Windows is really easy to install-but what if you had started in the world of MacOS/*nix OSes and miss that single command to call Python or Pip? What if you don't have access to modify your environment PATH?

Windows PowerShell has a feature called "Profiles" which allows you to configure your PowerShell in a similar fashion as you could with Bash, Zsh, etc.

Pretty cool huh?

Create a Profile

@troyfontaine
troyfontaine / readme.md
Last active February 17, 2024 02:21
Logging SFTP interactions on a Chrooted User in Ubuntu 14.04

How to setup SFTP Logging on Ubuntu 14.04 for a Chrooted User

Prerequisites: Using internal-sftp for sftp; rsyslog for logging

Step 1. Set up your chrooted directories

sudo mkdir /sftp/myshare
sudo mkdir /sftp/myothershare

Step 2. Create your groups for your chrooted users