Skip to content

Instantly share code, notes, and snippets.

@dadatuputi
dadatuputi / zfs_smart.sh
Last active February 12, 2024 16:13
Run SMART tests on a ZFS pool
#!/bin/bash
usage() { echo "Usage: $0 -p <POOL> (-s|-l)" 1>&2; exit 1; }
while getopts ":p:sl" o; do
case "${o}" in
p)
p=${OPTARG}
;;
s)
@dadatuputi
dadatuputi / raspbian-python3.5.md
Last active January 4, 2019 12:30 — forked from dschep/raspbian-python3.6.rst
Installing Python 3.5 on Raspbian

Installing Python 3.5 on Raspbian

As of June 2017, Raspbian does not yet include Python 3.5. This means we will have to build it ourselves, and here is how to do it.

  1. Install the required build-tools (some might already be installed on your system). If one of the packages cannot be found, try a newer version number (e.g. libdb5.4-dev instead of libdb5.3-dev).
@dadatuputi
dadatuputi / findpi.sh
Last active October 4, 2021 12:44
BASH script to find Raspberry Pis on a local network
#!/bin/bash
# findPi:
# Find all Pi's on the LAN
# Replace '10.1.0.0/21' below with your subnet and subnet mask
#
# Should have `net-tools` installed in Debian (apt install net-tools)
fping -a -r1 -g 192.168.1.1/24 &> /dev/null
arp -n | grep -i "B8-27-EB\|DC:A6:32"
@dadatuputi
dadatuputi / fixgit.sh
Created March 14, 2018 15:58
Update git repo and history with new name and email address - useful for removing PII from git history
#!/bin/sh
git filter-branch -f --env-filter '
CORRECT_NAME="Darkwing Duck"
CORRECT_EMAIL="1217269+dduck@users.noreply.github.com"
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
' --tag-name-filter cat -- --branches --tags
@dadatuputi
dadatuputi / shrink_linux_vmdk.md
Last active March 14, 2018 16:38
Shrink Linux VMDK

Shrinking Linux VMDK

Within Linux VM:

Remove unused dependencies

sudo apt autoremove

Clear apt cache

@dadatuputi
dadatuputi / mount-unlock-vhd.ps1
Last active January 29, 2020 13:46
Powershell - Mount and unlock Bitlocker VHD
# Escalate script if not run as administrator
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
# Relaunch as an elevated process:
Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
exit
}
# Mount vhd file
# Use the following path if the vhd file is in the same directory as this script:
@dadatuputi
dadatuputi / unmount-vhd.ps1
Last active October 14, 2018 21:32
Powershell - Unmount VHD
# Escalate script if not run as administrator
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
# Relaunch as an elevated process:
Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
exit
}
# Unmount vhd file
# Use the following path if the vhd file is in the same directory as this script:
@dadatuputi
dadatuputi / iPXE EdgeRouter Settings
Last active September 22, 2018 05:15 — forked from Fossil01/gist:b3ae40dfcb4405601489
Edgerouter / VyOS / Vyatta iPXE DHCP Options
set service dhcp-server global-parameters "if exists user-class and option user-class = &quot;iPXE&quot; {"
set service dhcp-server global-parameters "filename &quot;http://192.168.1.3:8080/boot.ipxe&quot;;"
set service dhcp-server global-parameters " } else { "
set service dhcp-server global-parameters "filename &quot;undionly.kpxe&quot;;"
set service dhcp-server global-parameters "}"
set service dhcp-server global-parameters "next-server 192.168.1.3;"
@dadatuputi
dadatuputi / Add_Hash_to_context_menu.reg
Created October 31, 2018 13:35
Windows 10 Hash Context Menu Install
Windows Registry Editor Version 5.00
; Created by: Shawn Brink
; Created on: March 5th 2017
; Tutorial: https://www.tenforums.com/tutorials/78681-file-hash-context-menu-add-windows-8-windows-10-a.html
[HKEY_CLASSES_ROOT\*\shell\hash]
"MUIVerb"="Hash"
"SubCommands"=""
@dadatuputi
dadatuputi / Remove_Hash_from_context_menu.reg
Created October 31, 2018 13:36
Windows 10 Hash Context Menu Uninstall
Windows Registry Editor Version 5.00
; Created by: Shawn Brink
; Created on: March 5th 2017
; Tutorial: https://www.tenforums.com/tutorials/78681-file-hash-context-menu-add-windows-8-windows-10-a.html
[-HKEY_CLASSES_ROOT\*\shell\hash]