Skip to content

Instantly share code, notes, and snippets.

My TrueNAS Scale server recently started throwing the following zfs module kernel panic on boot:

PANIC at space_map.c:405:space_map_load_callback()

What follows are the steps I took to retrieve the data from the corrupted zfs pool.

Getting setup

@porjo
porjo / phpredis_pecl_centos6.md
Last active February 6, 2020 04:33
how to install phpredis on Centos6 using pecl

How to install phpredis extension on Centos6 using pecl:

# Enable EPEL repository
yum install epel-release

# Install Autoconf v2.68
yum install autoconf268

# Install the extension
@porjo
porjo / citrix_fedora.md
Last active January 14, 2020 03:32
Install Citrix ICA client on Fedora

Running Citrix ICA client on Fedora

  • Download 'Receiver for Linux Web client (x86_64)' from Citrix website
  • Install package e.g.dnf install ICAClientWeb-rhel-13.10.0.20-0.x86_64.rpm
  • Install dependencies (not sure if all these are required):
sudo dnf install compat-openssl10 motif libXaw libidn1.34 libjpeg-turbo-utils
  • Modify launcher /usr/share/applications/wfica.desktop:
@porjo
porjo / ssl_CN_lookup_by_IP.sh
Created December 6, 2019 00:29
Given a list of IP addresses (in file 'ips') find what the SSL CN (subject) is for each one.
#!/bin/bash
# Given a list of IP addresses (in file 'ips') find what the SSL CN (subject) is for each one.
echo -en "IP\tSSL CN\n"
for i in `cat ips`; do
echo -en "$i\t"
out=`timeout 2 bash -c "openssl s_client -showcerts -connect $i:443 < /dev/null 2> /dev/null | openssl x509 -noout -subject 2> /dev/null | grep 'subject=' | sed -rn 's/.*CN=([^ /]+).*/\1/p'"`
if [ $? -eq 124 ]; then
echo "(timeout)"
@porjo
porjo / aws_sign_v4.php
Created April 16, 2019 05:27
PHP function to generate curl headers suitable for signed requests agains AWS API
// Sign the request and return header array for use by curl
//
// For HTTP methods with no payload (GET,DELETE) leave $Payload , $ContentType empty
//
// Based on: http://usefulangle.com/post/34/aws-s3-upload-api-php-curl
private function SignRequest($Method, $URL, $Payload='', $ContentType='')
{
if(!defined('AWS_ACCESS_KEY_ID') || !defined('AWS_SECRET_ACCESS_KEY') || !defined('AWS_REGION'))
return null;
@porjo
porjo / random_ip.go
Created February 11, 2019 00:12
Generate random IPs with Go
package main
import (
"encoding/binary"
"fmt"
"math/rand"
"net"
)
func main() {
@porjo
porjo / exetel.15m+.sh
Created December 24, 2018 11:29
Argos / Bitbar shell script for fetching Exetel usage stats
#!/usr/bin/env bash
echo "Exetel"
echo "---"
USERNAME="076543210"
PASSWORD="xxxxx"
MinAge=5
COOKIE="/tmp/exetel.cookies"
JSON="/tmp/exetel.json"
@porjo
porjo / elb_compare.sh
Last active November 13, 2018 00:54
Compare AWS ELB response times
#!/bin/bash
# compare AWS ELB: CLB (classic) and ALB (application) response times
# all output times are in seconds
CLB_URL="https://clb.example.com"
ALB_URL="https://alb.example.com"
clb_wins=0
alb_wins=0
@porjo
porjo / pulseaudio_rtp.md
Last active March 19, 2024 04:13
Use Pulseaudio to stream audio file to network via RTP

RTP Server

Setup

pacmd load-module module-null-sink sink_name=rtp format=s16le channels=1 rate=16000
pacmd load-module module-rtp-send source=rtp.monitor

This sets up a multicast socket for RTP streams. When I tested this was 224.0.0.56:46136

@porjo
porjo / httpGetMux.go
Last active August 4, 2018 08:00
GET a HTTP resource using multiple goroutines and mux the result into an output file
package main
import (
"bufio"
"flag"
"fmt"
"io"
"net/http"
"os"
"strconv"