Skip to content

Instantly share code, notes, and snippets.

View hdevalence's full-sized avatar

Henry de Valence hdevalence

View GitHub Profile
@hdevalence
hdevalence / corruptfile.sh
Last active December 17, 2022 06:28
Btrfs corrupt file locator
#!/usr/bin/bash
echo "Looking for failed csum inodes...."
inodes=`dmesg | grep csum | sed 's/^.*ino \([0-9]*\) .*$/\1/g' | uniq`
echo "Finding system files from inodes..."
sysfiles=`for i in $inodes; do find /etc /opt /root /srv /usr /var -inum $i 2>/dev/null; done`
echo "Finding user files from inodes..."
homefiles=`for i in $inodes; do find /home -inum $i 2>/dev/null; done`
echo "Attempting to reinstall corrupted packages..."
# Get list of packages with corrupt files
packages=$(for f in $sysfiles; do pacman -Qqo $f 2>/dev/null; done)
@hdevalence
hdevalence / gist:8050365
Created December 20, 2013 04:16
cond vs elem test
import System.Environment (getArgs)
import Control.Monad (liftM)
import Criterion.Main
testElemS :: String -> Bool
testElemS = flip elem ["a", "b", "c", "d", "e"]
testCondS :: String -> Bool
testCondS x = (x == "a" || x == "b" || x == "c" || x == "d" || x == "e")