Skip to content

Instantly share code, notes, and snippets.

View eggbean's full-sized avatar

Jason Gomez eggbean

  • London, United Kingdom
  • 10:51 (UTC)
View GitHub Profile
@eggbean
eggbean / install_scoop.ps1
Last active March 2, 2024 23:45
PowerShell script to install scoop for multi-users and install packages that I use.
# PowerShell script to install scoop for multi-user and packages.
# If scoop is already installed, any additional packages are installed
# and shims are reset in order of the package list.
# Test if Admin
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{ Write-Host "This script requires administrative privileges."; Exit }
# Check if scoop is installed
Function Test-ScoopInstalled {
@eggbean
eggbean / install_golang.sh
Last active February 25, 2024 05:22
Script for automated installation or updating Go. For Linux and macOS, x86_64, arm64 and arm.
#!/bin/bash -e
# This script installs or updates to the latest version of Go.
# Multi-platform (Linux and macOS)
# Multi-architecture (amd64, arm64, arm) support
#
# Add to your .profile, .bash_profile or .zshenv:
# export PATH=$PATH:/usr/local/go/bin
error_string=("Error: This command has to be run with superuser"
@eggbean
eggbean / install_getssl.sh
Last active December 10, 2023 13:19
Script for automated installation or updating the latest version of getssl (https://github.com/srvrco/getssl) using the binary packages. For Debian and RHEL-based systems.
#!/bin/bash
error_string=("Error: This command has to be run with superuser"
"privileges (under the root user on most systems).")
if [[ $(id -u) -ne 0 ]]; then echo "${error_string[@]}" >&2; exit 1; fi
eval "$(. /etc/os-release && typeset -p ID)"
if [[ $ID =~ ^(debian|ubuntu)$ ]]; then
pkg=deb
apt-get update
@eggbean
eggbean / windirstat-add-context-menu.reg
Last active February 15, 2024 10:38
WinDirStat registry file to add context menu entries to open on drives or folder, with a little icon
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\windirstat]
[HKEY_CLASSES_ROOT\Directory\Background\shell\windirstat]
@="Open WinDirStat here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\windirstat]
"Icon"=hex(2):43,00,3A,00,5C,00,50,00,72,00,6F,00,67,00,72,00,61,00,6D,00,20,\
00,46,00,69,00,6C,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,00,5C,00,\
@eggbean
eggbean / install_nginx.sh
Last active November 29, 2023 00:28
Script to install nginx from nginx repository. I use it to make images for auto-scaling instances.
#!/bin/bash
# Installs nginx from nginx repository (not distro repo)
#
# Usage: sudo ./install_nginx.sh [ --stable ]
# --stable option: Use stable channel instead of mainline
#
# Currently supported:
# RHEL
# CentOS
@eggbean
eggbean / oci-fupdate
Last active November 3, 2023 00:01
Firewall Network Security Group update script for Oracle Cloud. Good for remote working or for use as cron job for people with dynamic IP addresses at home.
#!/bin/bash
# Oracle firewall update script
# Usage: oci-fupdate [ <source-CIDR> ] [ --query ]
#
# Updates an existing Network Security Group to allow SSH access through the OCI
# firewall to reach instances in a public subnet, like bastion hosts. With no
# argument your current public IP address is used, or you can add a source address
# block in CIDR format. The --query option returns the current source address.
#
@eggbean
eggbean / AltGr-to-Alt-and-PrtSc-to-Context-Menu.reg
Created July 3, 2023 12:10
Windows registry key to change PrtSc key to Context Menu key and AltGr to Alt (you can still Ctrl+Alt to get the same function as AltGr. This is useful for ThinkPad users in the UK in particular.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,5d,e0,37,e0,38,00,38,e0,\
00,00,00,00
@eggbean
eggbean / vimium-options.json
Last active August 15, 2023 04:47
Vimium partial site exclusions so that the native keybindings can be used. Granular exclusions for GitHub which still allow vimium keys on pages which benefit from them. `:%s/eggbean/YOURUSERNAME/'`. Use with the essential 'web search navigator' Firefox/Chrome extension.
{
"settingsVersion": "1.67.4",
"exclusionRules": [
{
"pattern": "^https?://www.google.com/(?!maps)*",
"passKeys": "/abcdefhijklmnopqrsuvwyz"
},
{
"pattern": "^https?://mail.google.com/*",
"passKeys": "#/?cdegijklprsux"
@eggbean
eggbean / kernel_update_check.sh
Last active June 6, 2023 05:13
Bash snippet to determine if the kernel has been updated, requiring a reboot. Tested on Debian and RHEL-based systems. If you put it in your .bashrc, surround it with (parentheses) so that it runs in a subshell, or execute it as a separate script, as otherwise it would change your nullglob shell option and current directory if sourced.
#!/bin/bash
cd /boot || exit 1
shopt -s nullglob ; for file in config-* ; do kernels+=( "${file#config-}" ) ; done
newest="$(printf '%s\n' "${kernels[@]}" | sort -V -t - -k 1,2 | tail -n1)"
current="$(uname -r)"
[[ $current != $newest ]] && echo "Reboot needed for new kernel"
@eggbean
eggbean / install_awscliv2.sh
Last active January 24, 2024 00:47
Script to install or update AWS CLI v2 on Linux/WSL (x86_64 and aarch64 supported). Can be used in ansible or bootstrap script.
#!/bin/bash
# AWS CLI v2 install/update script
# For v2 you either need to install manually
# or use a script like this
#
# For bash v5 >
#
# For auto-completion add `cli_auto_prompt = on` to config
# ..or add AWS_CLI_AUTO_PROMPT=on environment variable