Skip to content

Instantly share code, notes, and snippets.

@psalz
psalz / detect_single_choice_attributes.js
Created April 5, 2016 20:00
Woocommerce Composite Products: Detect single choice attributes
"use strict";
(function ($) {
/**
* Detects all component attributes that have only a single value option and adds the '.single-choice' class
* to the respective table row. Additionally, a <span> with the class '.single-choice-label' is added, containing
* the options name.
*
* If executed twice, the previous changes are reverted first (in order to account for possible scenario changes).
* Default values or previous selections are saved and restored if the option becomes available again.
@psalz
psalz / clang_tidy_stats.py
Created July 27, 2022 12:53
Print number of unique occurences of clang tidy diagnostics in a given log file
#!/usr/bin/env python3
import sys
import re
from typing import Dict, Set
clang_tidy_log = sys.argv[1]
# A clang-tidy diagnostic is of the form:
# <path>:<line>:<column>: <warning|error>: <message> [<diagnostic-name(s)>]
@psalz
psalz / tcp_throughput.sh
Created July 11, 2025 07:47
Measure TCP throughput between a client and server
#!/bin/sh
set -o errexit -o nounset -o noclobber
usage() {
echo 1>&2 "Intercept TCP communication between a client and server to measure throughput"
echo 1>&2 "Usage: $0 <MODE> <LISTEN_PORT> <CONNECT_PORT>"
echo 1>&2 "Where MODE can either be UP or DOWN, for measuring upstream throughput (client to server) or downstream throughput (server to client)"
exit 1
}