Skip to content

Instantly share code, notes, and snippets.

@davidjenni
davidjenni / cidrToIpRange.ps1
Created January 7, 2020 18:08
CIDR to IP range conversion using PowerShell
# calculate IP address range from CIDR notation
# https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
function cidrToIpRange {
param (
[string] $cidrNotation
)
$addr, $maskLength = $cidrNotation -split '/'
[int]$maskLen = 0
@davidjenni
davidjenni / brew-multiuser.sh
Created April 6, 2018 00:59
HomeBrew: multi-user config change to allow all users in staff group to call 'brew'
#!/bin/sh
# Configure homebrew permissions to allow multiple users to call 'brew'.
# Any user from the staff group will be able to manage the homebrew and cask installation on the machine.
# in newer macOS version (>= HighSierra ?), changing perms on /usr/local itself is rejected
sudo chgrp -R staff /usr/local/*
sudo chmod -R g+w /usr/local/*
@davidjenni
davidjenni / Debian-Docker-SSH-StackScript.sh
Created July 22, 2015 06:59
Linode StackScript for Debian with git, SSH, Docker
#!/bin/bash
# Brings up a Linode VPS with Debian kernel with git, SSH, Docker and firewall installed
# <UDF name="sys_hostname" label="System hostname" default="myvps" example="Name of your server, i.e. linode1." />
# <UDF name="user_name" label="User account name" example="This is the account that you will be using to log in." />
# <UDF name="user_password" label="User password" />
# <UDF name="user_sshkey" label="Public Key for user" default="" example="Recommended method of authentication. It is more secure than password log in." />
# fail immediately if cmd fails; unset env variables will fail the script:
set -e
set -u