Skip to content

Instantly share code, notes, and snippets.

View korjaa's full-sized avatar

Jaakko Korhonen korjaa

View GitHub Profile
@korjaa
korjaa / egpu_razer_core_x.md
Last active July 22, 2022 19:28
Notes for Ubuntu 20.04 external GPU setup

grub bootloader changes

Two changes were required for GRUB bootloader

Delay

Adding 15 second boot menu delay to grub config solves thunderbolt boot failure.

Delay is added to /etc/default/grub

$ cat /etc/default/grub
...
@korjaa
korjaa / cv2_player.py
Created August 7, 2022 18:45
OpenCV Player
import logging
import cv2
def main():
cap = cv2.VideoCapture("uhU.webm")
cap.set(cv2.CAP_PROP_POS_MSEC, 1000.0)
#cap.set(cv2.CAP_PROP_POS_FRAMES, 1000.0)
w, h = cap.get(cv2.CAP_PROP_FRAME_WIDTH), cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
@korjaa
korjaa / avg_dbm.py
Last active September 9, 2022 11:10
Average dBm
def average_dbm(dbms):
# https://en.wikipedia.org/wiki/Decibel
# https://en.wikipedia.org/wiki/LogSumExp
# Less numerically stable version:
# 10*numpy.log10(numpy.mean(numpy.power(10, (dbms-30)/10)))
bel_np = 0.5 * numpy.log(10) # Bel & Neper by definition
dbel_np = bel_np / 10
np_to_db = 1 / dbel_np