Skip to content

Instantly share code, notes, and snippets.

View JBlond's full-sized avatar

Mario JBlond

  • Germany
  • 11:52 (UTC +02:00)
View GitHub Profile

Recovering deleted files in Ubuntu with ext4 filesystem

Recently, I deleted some files by mistake in a Ubuntu machine with an ext4 fs. These notes document the steps I took to get them back.

Important

  • this procedure assumes that the partition that contained the deleted files is different from the root partition, as that was the scenario with which I had to deal (deleted files were in my home dir). The procedure needs that the partition that contained the files is unmounted, so if the deleted files were in the root partition, the process would be a bit different (e.g. storing the fs journal in a USB stick, using a live CD/USB to boot and issue the commands, etc.)
  • if something is not clear, you need more information, etc. check the sources below

With that out the way, let's begin.

@JBlond
JBlond / android_security_setup.sh
Created August 6, 2025 09:57
Check Android security
#!/bin/bash
echo "📱 Android Security Check startet..."
# Prüfen, ob Gerät verbunden ist
if ! adb devices | grep -w "device" > /dev/null; then
echo "❌ Kein Gerät verbunden. Bitte USB-Debugging aktivieren und Gerät anschließen."
exit 1
fi
@JBlond
JBlond / git-change-protocol
Created July 7, 2025 09:39
git-change-protocol
#!/usr/bin/env bash
# Get current remote URL
currentURL=$(git config --get remote.origin.url)
# Exit early if no remote URL is set
if [[ -z "$currentURL" ]]; then
echo "No remote.origin.url is set. Nothing to do."
exit 0
fi
@JBlond
JBlond / README.md
Created November 9, 2024 09:12
truenas-qemu-guest-agent

TrueNAS 13 QEMU Guest Agent

This is a guide for Installing and Configuring QEMU Guest Agent for TrueNAS 13. It is based on the QEMU Guest Agent and VirtIO Console driver from FreeBSD 13.

Requirements

Due to the TrueNAS kernel lacking certain FreeBSD drivers, it's necessary to download the FreeBSD 13 kernel, extract the VirtIO Console driver and integrate it into the TrueNAS system. This ensures TrueNAS compatibility with virtualized environments.

Required packages for this guide:

@JBlond
JBlond / HumidityCalculator.py
Created October 18, 2024 07:34
HumidityCalculator.py
import math
class HumidityCalculator:
def calculate_absolute_humidity(
self,
relative_humidity: float,
temperature: float,
temperature_in_fahrenheit: bool = False,
is_relative_humidity_in_percent: bool = True
) -> float:
@JBlond
JBlond / disk_info.sh
Created August 9, 2024 12:58
smartctl check all drives
#!/bin/bash
for i in {a..r}; do
echo "Disk sd$i" $SN $MD
smartctl -H /dev/sd$i | grep -v "smartctl " | grep -v "Copyright " | grep -v "=== START"
done
@JBlond
JBlond / markdown.conf
Created July 31, 2024 07:55 — forked from sffc/markdown.conf
Apache config to render *.md files as HTML (client-side). Prefer server-side rendering? See https://github.com/sffc/apache-php-markdown/blob/master/README.md
# File: /etc/apache2/conf-available/markdown.conf
#
# Copyright (c) 2018 Shane F. Carr
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@JBlond
JBlond / nginx.conf
Last active July 31, 2024 07:50
openresty-windows
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@JBlond
JBlond / isonline.cmd
Last active May 21, 2024 13:48
is online bach windows / pingable
@echo off
IF "%~1" == "" GOTO noinput
@ping -n 1 %1 | find "TTL"
if ERRORLEVEL 1 (
echo offline
) else (
echo okay
)
GOTO end
@JBlond
JBlond / observe.sh
Created July 7, 2023 10:58
Update Observium CE
#!/bin/bash
cd /opt
mv observium observium_old
wget -Oobservium-community-latest.tar.gz https://www.observium.org/observium-community-latest.tar.gz
tar zxvf observium-community-latest.tar.gz
mv /opt/observium_old/rrd observium/
mv /opt/observium_old/logs observium/
mv /opt/observium_old/config.php observium/
/opt/observium/discovery.php -u