[ ] Tuesday, 24 February 2015 [ ]

cli

While looking for:

this tweet I came across which also works for OpenBSD:

port:fred ~> for i in machine model ncpu               
Finish the line --> do sysctl hw.$i              
Finish the line --> done
hw.machine=amd64
hw.model=Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz
hw.ncpu=4

But pgrep on OpenBSD does not have a -c count option so the OpenBSD version would be:

#!/bin/ksh
#
#set -x
while [[ $(pgrep -f "ssh" | wc -l) -le 8 ]]
do
        sleep 2;
done
echo "We have more than 8 connections"

reset

For fixing broken terminals.

tee

Can be used to write a file in vi / vim when you don't have write permissions:

:w !sudo tee %

Benchmarks are Bad

benchmarks are bad: a reply on misc@ from Nick Holland.

DRY

Don't Repeat Yourself

coderesettee


$Id: diary,v 1.38 2025/01/01 22:43:54 fred Exp $