This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <event2/event.h> | |
#include <event2/thread.h> | |
#include <event2/util.h> | |
#include <stdlib.h> | |
#include <pthread.h> | |
#include <assert.h> | |
#include <unistd.h> | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
for i in {1..8}; do | |
truncate -s10m loop-$i | |
losetup /dev/loop$i loop-$i | |
done | |
mdadm -CR /dev/md0 --metadata 1.1 --level raid10 --raid-disks 4 /dev/loop{1..4} | |
# recovery | |
sleep 1m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
head -c100M /dev/zero > /tmp/zero | |
cp /tmp/zero /srv/nfs4/zero | |
exec 3</mnt/nfs4/zero | |
exportfs -f | |
rpc.nfsd 0 | |
exportfs -r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import re | |
""" | |
Decode kernel message from mpt*sas, like: | |
mpt3sas_cm0: log_info(0x31120303): originator(PL), code(0x12), sub_code(0x0303) | |
mpt2sas_cm0: log_info(0x31120303): originator(PL), code(0x12), sub_code(0x0303) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function match() | |
{ | |
local f="$1" && shift | |
[[ "$f" =~ [^/]*\.conf$ ]] && { | |
local o=( | |
'^cert ' | |
'^key ' | |
'^tls-auth ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#include <event2/event.h> | |
#include <event2/thread.h> | |
void | |
cb( evutil_socket_t fd, short what, void *arg ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys, os, time | |
import subprocess | |
import argparse | |
import re | |
def exec(cmd): | |
return subprocess.check_output(cmd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function usage() | |
{ | |
cat - <<EOL | |
Get DIMM Bank Locator (via dmidecode) by ADDR from mcelog | |
(tested with dmidecode 3.1) | |
Usage: $0 <addr> | |
EOL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gettimeofday(): 53.7 *1e6 # vdso | |
getpid(): 15.4 *1e6 # non-vdso | |
3.5x time slower |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/libevent/libevent/issues/674#issuecomment-409853793 | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <unistd.h> | |
#include <inttypes.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> |