Skip to content

Instantly share code, notes, and snippets.

@jaka
jaka / to_bookworm.sh
Created August 6, 2023 13:33
Upgrade to Debian Bookworm
find /var/lib/apt/lists/ -mindepth 1 -maxdepth 1 -type f -size +0 -print -delete
file=/etc/apt/sources.list
if [ -f "$file" ]; then
owner=$(stat -c %U:%G "$file")
perms=$(stat -c %a "$file")
mv -v "$file" "$file.$(date +%y%m%d%H%M%S)"
fi
[ -z "$owner" ] || owner="root:root"
[ -z "$perms" ] || perms=644
@jaka
jaka / atmega328pb.sh
Created March 16, 2021 17:52
install atmega382pb
7z e Atmel.ATmega_DFP.1.6.364.atpack gcc/dev/atmega328pb/avr5/libatmega328pb.a gcc/dev/atmega328pb/avr5/crtatmega328pb.o include/avr/iom328pb.h
mv libatmega328pb.a crtatmega328pb.o /usr/lib/avr/lib/avr5/
mv iom328pb.h /usr/lib/avr/include/avr/
@jaka
jaka / digitemp_log.bat
Created February 16, 2021 18:59
Quick & dirty batch file for logging with digitemp.exe on Windows
@echo off
::
SET LOGDIR=logs
:: generate log filename
SET filedate=%DATE:~-4,4%_%DATE:~-7,2%_%DATE:~-10,2%
SET filetime=%TIME:~0,-3%
SET filetime=%filetime::=_%
SET filename=%LOGDIR%\%filedate%_%filetime%.log
mkcopy() {
[ -f "$1.bak" ] || cp -v "$1" "$1.bak"
}
##########
dev=/dev/vdb
mkfs.ext4 -b 4096 "$dev"
UUID="$(blkid $dev | sed -n -r "s/.*\sUUID=\"([^\"]*)\".*/\1/p")"

Since Firefox does not support split mode for extensions in incognito mode, extensions that use split value for incognito key inside manifest.json configuration file might not be (side)loaded at browser startup.

One solution is simply removing incognito key from manifest.json:

sed -i "/^\s*\"incognito\":\s*\"split\",/d" manifest.json

I figured this out when running Debian Buster with Firefox 68.2.0esr with webext-ublock-origin package since the browser did not load uBlock Origin.

@jaka
jaka / debian-buster-rng.md
Created July 29, 2019 14:17
Slow SSH startup in Debian Buster

After upgrading to a recent kernel, eg. 5.2.4, starting of SSH service at system startup (boot) was failing, and succeed after some time: greater rhen 1 minute.

After looking at dmesg SSH managed to start after crng init done.

# dmesg |grep random
[    0.185244] random: get_random_u32 called from 0xffffffff811ff3f4 with crng_init=0
[    0.599283] random: fast init done
[    0.716647] random: systemd: uninitialized urandom read (16 bytes read)
[    0.717253] random: systemd: uninitialized urandom read (16 bytes read)
[    0.717344] random: systemd: uninitialized urandom read (16 bytes read)
Function Set-Default_2([String]$Ext, [String]$Value)
{
$Classes = "HKLM:\SOFTWARE\Classes\"
$Path = Join-Path -Path $Classes -ChildPath $Ext
If (!(Test-Path -Path $Path))
{
New-Item -Path $Path
}
Set-ItemProperty -Path $Path -Name "(Default)" -Type String -Force -Value ($Value + $Ext)
}
Function Set-Default([Array]$Exts, [String]$Value)
{
ForEach ($Ext in $Exts)
{
$Classes = "HKLM:\SOFTWARE\Classes\"
$Path = Join-Path -Path $Classes -ChildPath $Ext
Set-ItemProperty -Path $Path -Name "(Default)" -Type String -Force -Value $Value
}
}
(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey

Capacitor code — Guide

Capacitor values are usually standardized: .10, .22, .33, .47 and so on. However, you might occasionally find an unusual value such as 0.15 or 0.27.

The codes below are generally found on ceramic (little round discs), MLCCs, and mylar (chicklet) capacitors, which are not polarized, that is, there are no positive and negative leads.

Usually the first two digits of the code represent part of the value; the third digit corresponds to the number of zeros to be added to the first two digits. This is the value in pF.

VALUE(pF) CODE