Skip to content

Instantly share code, notes, and snippets.

View jkirk's full-sized avatar

Darshaka Pathirana jkirk

View GitHub Profile
@jkirk
jkirk / maker-faire-vienna-2023.md
Last active July 1, 2023 16:39
Maker Faire Vienna 2023
@jkirk
jkirk / Enable ZFS in Grml
Created December 13, 2022 12:30
grml-zfs
#!/bin/bash
# See: https://github.com/grml/grml-live/issues/78#issuecomment-641141556
sudo apt update
sudo apt install --yes linux-headers-$(uname -r) gcc
sudo apt install --yes --no-install-recommends zfs-dkms
sudo modprobe zfs
sudo apt install --yes zfsutils-linux

Minimal shell (with grml-config)

sudo apt install vim zsh tmux git
wget grml.org/scripts/grml-config.sh
sh ./grml-config.sh
chsh -s /bin/zsh

Startship

@jkirk
jkirk / qnap_recovery.md
Created April 13, 2022 16:25
Access QNAP encrypted HDD with GNU/Linux Debian

QNAP HDD Recovery Test (encrypted)

Removed HDD-2 from NAS (while running) and plugged into a Sharkoon USB-Bay and tried to recover data.

Tried to assemble all existing volumes:

  % sudo mdadm --assemble --scan
  mdadm: /dev/md/9 has been started with 1 drive (out of 24).
  mdadm: /dev/md/256 has been started with 1 drive (out of 2).
@jkirk
jkirk / ara_functions.md
Created November 23, 2021 20:05
ARA Records Ansible Functions

ARA Records Ansible Functions

.zshrc.local:

# ansible ara functions
function ara_playbooks() { ara playbook list --limit ${1:=10} }
function ara_playbooks_checkrun() { ara playbook list --label "check:True" --limit ${1:=10} }
function ara_playbooks_fullrun() { ara playbook list --label "check:True" --limit ${1:=10} }
function ara_last() { ara playbook list --limit 1 -c id -f value }
function ara_hosts_changed() { ara result list --playbook $1 --limit 100 --resolve -c id -c host --changed }
@jkirk
jkirk / samba-list-expired-passwords.sh
Created July 5, 2021 21:38
List expired Samba domain account passwords
#!/bin/bash
# Inspired from: https://linux.samba.narkive.com/J6bwFGaF/samba-users-list-and-the-date-the-password-will-expire#post15
# Get path to sam.ldb
LDBDIR=$(samba -b | grep 'PRIVATE_DIR' | awk -F ':' '{print $NF}' | sed 's/^ *//g')
if [ -z "${LDBDIR}" ]; then
echo "This is supposed to be a DC, but cannot obtain the Private dir."
echo "Cannot Continue...Exiting."
exit 1
else