Skip to content

Instantly share code, notes, and snippets.

View chuckn246's full-sized avatar
🎯
Focusing

Chuck Nemeth chuckn246

🎯
Focusing
View GitHub Profile
@chuckn246
chuckn246 / update-keepassxc-appimage.sh
Last active February 5, 2023 02:49
Download, verify and install (or upgrade) KeePassXC AppImage on Linux
#!/bin/sh
# Description: Download, verify and install KeePassXC AppImage on Linux
# Author: Chuck Nemeth
# https://github.com/keepassxreboot/keepassxc
bin_dir="$HOME/.local/bin"
tmp_dir="$(mktemp -d /tmp/kpxc.XXXXXXXX)"
desktop_dir="$HOME/.local/share/applications"
@chuckn246
chuckn246 / configure-aws-cli-sso.sh
Last active February 5, 2023 14:04
Configure aws-cli and sso
#!/bin/sh
# Description: Configure aws-cli accounts to use SSO
# Author: Chuck Nemeth
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
# https://ben11kehoe.medium.com/you-only-need-to-call-aws-sso-login-once-for-all-your-profiles-41a334e1b37e
# Can fetch ACCOUNT_IDs by running (if aws-cli is already working):
# aws --profile admin organizations list-accounts --query 'Accounts[].[Id,Name]'
# Otherwise, just grab them from the AWS Management Console
@chuckn246
chuckn246 / loadkeys.sh
Last active February 6, 2023 22:32
Add ssh keys to ssh-agent on Linux
#!/usr/bin/env bash
# Description: Load ssh keys in $keydir to ssh-agent
# Author: Chuck Nemeth
# Define variables
keys=( main work aws )
case "$1" in
"" | "${keys[0]}")
keydir="$HOME/.ssh"
@chuckn246
chuckn246 / gist:7c17640d33c2abab8f31bc5f46bf2e8f
Created March 7, 2021 15:13
Resizing a filesystem using qemu-img and fdisk

Occasionally we will deploy a virtual instance into our KVM infrastructure and realize after the fact that we need more local disk space available. This is the process we use to expand the disk image. This process assumes the following:

  • You're using legacy disk partitions. The process for LVM is similar and I will describe that in another post.
  • The partition you need to resize is the last partition on the disk.

This process will work with either a qcow2 or raw disk image. For

@chuckn246
chuckn246 / bash-colors.md
Created April 4, 2020 18:50 — forked from JBlond/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@chuckn246
chuckn246 / stretch-preseed.txt
Last active September 4, 2023 17:11
Debian Preseed with Encrypted LVM
#### Contents of the preconfiguration file (for stretch)
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US
# Keyboard selection.
d-i keyboard-configuration/xkb-keymap select us
# d-i keyboard-configuration/toggle select No toggling
### Network configuration
@chuckn246
chuckn246 / recursive-resize
Created July 15, 2016 03:29
Recursively resize and rename images with imagemagick convert.
for d in ./*/ ; do (cd "$d" && convert -define jpeg:size=WxH *.jpg -thumbnail 'WxH>' -background white -gravity center -extent WxH -set filename:newname "%t.%e" 'rose_%[filename:newname]'); done
@chuckn246
chuckn246 / .htaccess
Created July 5, 2016 14:46 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/