Skip to content

Instantly share code, notes, and snippets.

View BastienM's full-sized avatar

Bastien MENNESSON BastienM

View GitHub Profile
@jbeda
jbeda / gist:16191ad2cec4835de40b
Last active November 4, 2024 08:46
IP CIDR math in bash
function increment_ipv4 {
local ip_base=$1
local incr_amount=$2
local -a ip_components
local ip_regex="([0-9]+).([0-9]+).([0-9]+).([0-9]+)"
[[ $ip_base =~ $ip_regex ]]
ip_components=("${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" "${BASH_REMATCH[3]}" "${BASH_REMATCH[4]}")
ip_dec=0
local comp
for comp in "${ip_components[@]}"; do
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 SP2 64bits AMIs provided by Amazon
#
# Inject this as user-data of a Windows 2008 AMI, like this (edit the adminPassword to your needs):
#
# <powershell>
# Set-ExecutionPolicy Unrestricted
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active December 11, 2025 14:31
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname