Skip to content

Instantly share code, notes, and snippets.

View vlad-ivanov-name's full-sized avatar

Vlad Ivanov vlad-ivanov-name

  • Munich, Germany
View GitHub Profile
@marcan
marcan / rpi_cam_auth.py
Created January 25, 2019 07:48
Raspberry Pi Camera V2 DRM authentication example
import hmac, hashlib
# Data from I²C trace at https://hackaday.io/project/19480-raspberry-pi-camera-v21-reversed/log/52547-i2c-logic-analyzer-trace
# Secret key from VideoCore blob
# serial[8], serial[7:4], serial[3:0]
serial = bytes.fromhex("EE8C196D8301230B59")
# rPi -> camera random number
numIn = bytes.fromhex("5805F3C898C3133154498E082F2E703516F2DBD1")
@bignall
bignall / dont-lose-konsole-terminal-sessions-on-reboot.md
Last active July 12, 2023 12:22 — forked from bguiz/dont-lose-gnome-terminal-sessions-on-reboot.md
Ensures that you don't lose your konsole sessions when you crash/ reboot Linux

Usage

  • Save the two files below. I put them in '~/.scripts'
  • Modify the configuration in konsole-watcher.sh to your liking
  • Modify the location of konsole-watcher.sh in konsole-watcher-autostart.sh if you chose to put it somewhere besides ~/.scripts
  • Create the directory ~/.konsole (or other location you chose for the save file)
  • Create a symlink to konsole-watcher-autostart.sh in '~/.config/autostart-scripts
  • or open System Settings > Startup and Shutdown and add a script to the Script Files (it does the same thing as creating the symlink)
  • You might want to add a menu entry as well in case KDE autostart doesn't work for some reason
@rygorous
rygorous / gist:1440600
Created December 6, 2011 23:36
PPC rlwinm/rlwimi equivalent C code
static inline U32 ppcmask(U32 mb, U32 me)
{
U32 maskmb = ~0u >> mb;
U32 maskme = ~0u << (31 - me);
return (mb <= me) ? maskmb & maskme : maskmb | maskme;
}
static inline U32 rotl32(U32 x, U32 amount)
{
return (x << amount) | (x >> ((32 - amount) & 31));