Skip to content

Instantly share code, notes, and snippets.

@mamrehn
mamrehn / fix_degraded_array.md
Created November 8, 2014 16:36
Recover degraded array in a software raid.

Source: Based on an artice at thomas-krenn.com (german, english translation) and raid.wiki.kernel.org.

1. Get a new hdd of same or greater size

Use feature comparison websites like gh.de or pricegrabber.com to find a suitable device.

2. Substitute with drive causing the failure

Check which drive is causing the degradation.

mdadm --examine /dev/sd[a-z] | egrep 'Event|/dev/sd'
@mamrehn
mamrehn / WekaSaveClassifier.java
Last active April 28, 2023 14:53
Simple example for a persistent classifier model in Weka (http://www.cs.waikato.ac.nz/ml/weka/). The Decision Tree (J48) can be exchanged with an arbitrary classifier.
//package ...;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import weka.classifiers.Classifier;
import weka.classifiers.trees.J48;
import weka.core.DenseInstance;
@mamrehn
mamrehn / remove_unused_kernels.sh
Created October 6, 2014 17:55
Frequent Linux (kernel) updates clutter the free disc space left on your hard drive. If everything works with the new version, delete the old ones with this small script.
#!/bin/sh
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge