Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / angular_on_canvas.html
Created November 11, 2014 14:05
Simple example of canvas drawing in Coffeescript, AngularJS using HTML5 Canvas. Interactive: http://plnkr.co/JZrYLo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>AngularJS Canvas Pixel Drawing</title>
<script>
document.write('<base href="' + document.location + '" />');
</script>
<link rel="stylesheet" href="style.css" />
@mamrehn
mamrehn / python-gpu.md
Last active August 29, 2015 14:16
Python packages
@mamrehn
mamrehn / README.md
Last active August 29, 2015 14:18
HTML5 WebSocket profiling using ws[s]://echo.websocket.org

WebSocket Test

ws://echo.websocket.org

iterations = 50
dataSize   = 512
mean [ms]  = 105.20454545454545
deviation  = 4.966156120337965
variance = 24.662706611570233
@mamrehn
mamrehn / README.md
Last active August 29, 2015 14:21
Binary Websocket Test

Quick way to test binary websocket API behaviour.

Example outcome:

# Up
object [object ArrayBuffer], Key data: 38, String data: ☁
string , Key data: 38, String data: ☁

# Down
@mamrehn
mamrehn / test.stl
Created September 27, 2015 13:02
An STL file format test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mamrehn
mamrehn / random_data_thresholded.stl
Created September 27, 2015 13:07
STL file format test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mamrehn
mamrehn / test.stl
Last active September 29, 2015 11:00
STL file format test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.