Skip to content

Instantly share code, notes, and snippets.

View Mausy5043's full-sized avatar

Maurice (mausy5043) Hendrix Mausy5043

  • The Netherlands
  • 18:22 (UTC +02:00)
View GitHub Profile
@Mausy5043
Mausy5043 / sysupdate.sh
Last active August 29, 2015 14:09
scripted system update for Debian-flavours
#! /bin/sh
sudo apt-get update
sudo apt-get autoclean
sudo apt-get autoremove
sudo apt-get upgrade
#! /bin/bash
minute=$(date "+%M")
if [ $minute -eq "54" ]; then
# Update the git scripts once every hour
cd /home/pi/gitbin
git fetch origin && git reset --hard origin/test && git clean -f -d
fi
@Mausy5043
Mausy5043 / mdadm
Last active March 25, 2019 15:36
md0 - RAID array state
@asgard ~]$ sudo mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Sat Mar 8 17:05:13 2014
Raid Level : raid6
Array Size : 5860267008 (5588.79 GiB 6000.91 GB)
Used Dev Size : 2930133504 (2794.39 GiB 3000.46 GB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent
@Mausy5043
Mausy5043 / syslog 11JAN2015
Created January 17, 2015 08:30
/var/log/syslog disk error
Jan 11 01:34:23 boson kernel: [457857.754171] ata6.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
Jan 11 01:34:23 boson kernel: [457857.755739] ata6.00: failed command: IDENTIFY DEVICE
Jan 11 01:34:23 boson kernel: [457857.757283] ata6.00: cmd ec/00:01:00:00:00/00:00:00:00:00/00 tag 14 pio 512 in
Jan 11 01:34:23 boson kernel: [457857.760370] ata6.00: status: { DRDY }
Jan 11 01:34:23 boson kernel: [457857.761900] ata6: hard resetting link
Jan 11 01:34:29 boson kernel: [457863.676731] ata6: link is slow to respond, please be patient (ready=0)
Jan 11 01:34:31 boson kernel: [457866.026590] ata6: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
Jan 11 01:34:32 boson kernel: [457866.499788] ata6.00: configured for UDMA/133
Jan 11 01:34:32 boson kernel: [457866.499822] ata6: EH complete
@Mausy5043
Mausy5043 / mdadm.conf
Last active March 25, 2019 15:40
mdadm.conf
# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#
#.....
# MHE: 20190325
CREATE owner=root group=disk mode=0660 auto=yes
# MHE: 20190323
# automatically tag new arrays as belonging to the local system
@Mausy5043
Mausy5043 / 20200531
Last active March 6, 2022 16:01
RAID-6 failing/failed disk exchange procedure
# The failing drive is indicated by it's device name.
# Because device names like `/dev/sde` are not static the failing drive could be any one of the disks in the array.
# Use this command to link the static WWN-id to its device name in the logging:
journalctl --since 2020-03-09 |grep /dev/sda |grep -e "WWN\|Prefail"
# Disks with problems today are:
WWN:5-0014ee-6055a237b and WWN:5-0014ee-605a043e2
The [237b] (POH:43332hrs) has 12 SMART errors (UNC) @ 42085hrs (T+1247) and an extended offline test failed @ 41930hrs
@Mausy5043
Mausy5043 / graph.py
Last active August 29, 2015 14:19
graphing example using numpy
#!/usr/bin/python
import matplotlib
matplotlib.use("Agg")
from matplotlib.dates import strpdate2num
import numpy as np
import pylab as pl
# /tmp/corrdata/txt contains comma-separated values
# YYY-MM-DD HH:MM:SS, float, float, float, etc.
@Mausy5043
Mausy5043 / CLI.md
Last active May 1, 2019 19:54
Setup SSH login without password

Setup SSH login without password

I am logged in on host "mac" as user "mausy" and want to remotely login on host "raspberry" as user "pi". But I don't want to have to enter my password every time. This is where SSH public keys come in handy.

(please note that all passwords and keys shown below are fictional)

NOTE: Make sure you have SSH installed on both hosts. SSH usually also comes with scp which will be used also.

I will start by creating a public key on host "mac":

mausy@mac ~ $ ssh-keygen -t rsa
@Mausy5043
Mausy5043 / grep for text
Last active December 3, 2015 18:12
FInd file(s) containing specific text
grep -rnw /path/to/search -e "text to find" 2>/dev/null
-- Default duration of the playlist (in seconds)
property reqDuration : 3 * 60 * 60
-- List with source(s) of playlists to use.
property listMusicPlaylists : {"Music"}
-- Name of the playlist to create
property myPlayList : "RandomMusic"
set cntM to count of listMusicPlaylists