Skip to content

Instantly share code, notes, and snippets.

View ThinGuy's full-sized avatar

craig bender ThinGuy

View GitHub Profile
@ThinGuy
ThinGuy / ubuntu-repo-size.bash
Last active March 26, 2025 22:14
Get Ubuntu Repo Size - Non standard repos are a WIP
#!/usr/bin/env bash
# vim: set et ts=2 sw=2 filetype=bash :
ubuntu-repo-size_usage() {
printf "\n\e[1m\e[2G${FUNCNAME%%_*}\e[0m\n\n"
printf "\e[1m\e[2GUsage\e[0m: ${FUNCNAME%%_*} [options]\n\n"
printf "\e[1m\e[2GOptions\e[0m:\n\n"
printf "\e[3G -a, --arch \e[28GArchitecture to display, i.e. amd64,arm64,armhf,i386,ppc64el,s390x (Default: amd64)\n"
printf "\e[3G -s, --series \e[28GRelease nicknames to get information for, (Default: current LTS)\n"
printf "\e[3G -c, --components \e[28GList of repo components to query (Default: main,universe,multiverse,restricted)\n"
@ThinGuy
ThinGuy / xrdp-install.sh
Last active February 11, 2024 02:19
Scripted XRDP Install with various fixes
#!/bin/bash
##############################
# Scripted XRDP Installation #
##############################
### Note: You can only be logged in via console or RDP, not both.
### If you get blackscreen via RDP or if console keeps going
### back to login screen, run `gnome-session-quit --force --logout`
### via ssh as the same user you are trying to login
sudo apt install \
gimp gimp-plugin-registry gimp-data-extras gimp-help-common gimp-help-en gimp-gap gimp-data -qyf \
$(apt-cache search -n '^obs-'|awk '/Studio|studio/&&!/websocket/{print $1}'|paste -sd' ') \
-yqf --auto-remove --purge
@ThinGuy
ThinGuy / fix-hydrapaper.sh
Created September 28, 2023 01:14
Fix thumbnail problems in Hydrapaper when on a python3-based system or when using Dark mode
#!/bin/bash
# Fix thumbnails (Long deprecated Image.ANTIALIAS finally removed in PIL 10.0.0)
sudo sed -i 's/Image.ANTIALIAS/Image.LANCZOS/g' /usr/lib/python3/dist-packages/hydrapaper/wallpaper_flowbox_item.py
# Fix merge issues when using Dark mode (known buy merging to a single wallpaper in dark mode)
sudo sed -i 's/ if set_dark else \x27picture-uri\x27//g' /usr/lib/python3/dist-packages/hydrapaper/wallpaper_merger.py
# Restart/Reload hydrapaper App
@ThinGuy
ThinGuy / dolphin-udev.sh
Last active July 12, 2023 04:07
udev rules for dolphin emulator on ubuntu - looks for mayflash devices, bluetooth dongles/radios, and logitech usb microphones
#!/bin/bash
# You can just paste this in a terminal rather than run it as a script.
# Up to you...
export RFILE=/etc/udev/rules.d/55-dolphin-emu.rules
[[ -f ${RFILE} ]] && { sudo rm -f ${RFILE}; }
sudo install -o0 -g0 -m 0644 /dev/null ${RFILE}
(for i in $(lsusb|awk 'BEGIN{IGNORECASE=1}/mayflash|logitech usb mic|bluetooth dongle|bluetooth radio/{print $6}');do
(printf "SUBSYSTEM==\"usb\", ENV{DEVTYPE}==\"usb_device\", ATTRS{idVendor}==\"${i%%:*}\", ATTRS{idProduct}==\"${i##*:}\", MODE=\"0666\", TAG+=\"uaccess\"\n";
@ThinGuy
ThinGuy / msad-lxd.sh
Last active August 26, 2024 16:57
Script to create a SAMBA based Active Directory Controller in a LXD unprivileged container
#!/bin/bash
export UBUNTU_PRO_TOKEN="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
export DNS_DOMAIN="atx.orangebox.me"
export MSAD_DOMAIN="ORANGEBOX"
export DC_HOSTNAME="msadc"
export SSH_IMPORT_ID="lp:craig-bender, gh:thinguy"
export UBUNTU_REPO="us.archive.ubuntu.com"
export UBUNTU_RELEASE="lunar"
export MSADMIN_PW="Ubuntu1+"
@ThinGuy
ThinGuy / demo-msad.yaml
Last active February 11, 2024 02:22
Create a MSAD Controller using SAMBA in an unprivileged LXD container in about 100 seconds, Includes creating 70+ MSAD accounts.
config:
boot.autostart: "true"
security.nesting: "true"
security.privileged: "false"
user.network-config: |
version: 2
ethernets:
eth0:
dhcp4: false
dhcp6: false
@ThinGuy
ThinGuy / maas-sunbeam-ci.yaml
Last active May 3, 2024 20:22
Automated Install of Project Sunbeam - Tested under MAAS 3.3.4 and 3.4.
# This is a cloud-init script to deploy Sunbeam (aka Microstack) on multiple
# nodes using MAAS.
#
# WARNING:
# This cloud-init example uses pre-generated host ssh keys to make things easier on the administrator
# when working on differnet nodes across the cluster.
# !!!THEY ARE NOT REQUIRED!!! and can be removed.
#
# See: https://cloudinit.readthedocs.io/en/latest/reference/examples.html#configure-instance-s-ssh-keys
#
@ThinGuy
ThinGuy / power-ps1.sh
Created May 5, 2023 22:16
Display a color-coded IEC 60417-5009 power symbol (⏻) in your Bash Primary Prompt String (PS1) when your host needs a reboot.
#############################################################################################
### Display the IEC 60417-5009 power symbol (⏻) at the end of your Bash Primary
### Prompt String (PS1) when the host needs a reboot. Color changes from green
### to red, depending on how many hours the host has
###
### Ex. craigbender@hpz600:~ ⏻
###
### PS1R - Red ⏻ - Host has needed a reboot for > 24 hours
### PS1Y - Yellow ⏻ - Host has needed a reboot for > 12 hours but < 24 hours
### PS1G - Green ⏻ - Host has needed a reboot < 12 hours
@ThinGuy
ThinGuy / supersub.sh
Last active April 29, 2023 19:44
Arrays for Super and Subscript numbers including i and n
declare -ag SUPS=($(printf '\u2070 \u00b9 \u00b2 \u00b3 \u2074 \u2075 \u2076 \u2077 \u2078 \u2079 \u207f \u2071\n'))
declare -ag SUBS=($(printf '\u2080 \u00b9 \u00b2 \u00b3 \u2084 \u2085 \u2086 \u2087 \u2088 \u2089 \u2099 \u1D62\n'))