Skip to content

Instantly share code, notes, and snippets.

View TobidieTopfpflanze's full-sized avatar
😅
Hey, Tobi here!

Tobi TobidieTopfpflanze

😅
Hey, Tobi here!
  • @home
View GitHub Profile
@TobidieTopfpflanze
TobidieTopfpflanze / Datatypes.md
Last active June 9, 2022 13:46
C datatypes + storage size

Datatypes

Type Storage size Value range
char 1 byte -128 to 127 or 0 to 255
unsigned char 1 byte 0 to 255
signed char 1 byte -128 to 127
int 2 or 4 bytes -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
unsigned int 2 or 4 bytes 0 to 65,535 or 0 to 4,294,967,295
short 2 bytes -32,768 to 32,767
@TobidieTopfpflanze
TobidieTopfpflanze / get_l4t_version.md
Last active November 3, 2021 10:03
Get Linux for Tegra version Jetson

Get Linux for Tegra version

head -n 1 /etc/nv_tegra_release
@TobidieTopfpflanze
TobidieTopfpflanze / file.md
Created August 19, 2021 09:01
Generate random file

Generate random file

dd if=/dev/urandom of=<destination> bs=1048576 count=<filesize>

Example

This will generate a random file with 1000MB

export function generateUUID(): string {
let dt = Date.now()
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = Math.trunc((dt + Math.random() * 16) % 16)
dt = Math.floor(dt / 16)
// eslint-disable-next-line no-bitwise
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16)
})
}
@TobidieTopfpflanze
TobidieTopfpflanze / Type-on-literal.ts
Created September 24, 2021 07:37
TypeScript: depend type on given literal
export type SelectorType = "option1" | "option2";
export type SelectType<S extends SelectorType> = S extends "option1"
? Type1
: S extends "option2"
? Type2
: never;
@TobidieTopfpflanze
TobidieTopfpflanze / drive.md
Created December 14, 2021 10:42
USB investigation (ubuntu 18.04)

Important commands:

# Get related infos for flashing (sector size, start and end addresses)
sudo fdisk -l /dev/sdc

# Alternative for better regex actions:
sudo sfdisk -d /dev/sdc

# Copy image to storage
@TobidieTopfpflanze
TobidieTopfpflanze / i2c.md
Last active February 28, 2024 12:13
Basic camera streaming and i2c bash usage

List i2c devices on a specific bus:

Syntax: i2cdetect [options] <busNr>

test@test-desktop:~$ i2cdetect -y -r 8
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@TobidieTopfpflanze
TobidieTopfpflanze / mkfilesystem.sh
Created January 14, 2022 11:25
Create and copy bootable filesystem L4T (template)
sudo parted /dev/sdb mklabel gpt
sudo parted /dev/sdb mkpart APP 0GB 32GB
sudo mkfs.ext4 /dev/sdb1
Put the Jetson device into recovery mode (middle button ~4 seconds… then combo left button ~4 seconds… then release both)
Connect USB-C from host to Jetson (port next to power light)
sudo BOOTDEV=sda1 ./flash.sh --no-flash jetson-agx-xavier-devkit sda1
sudo mount /dev/sdb1 /mnt
sudo mkdir tmp_system
sudo mount bootloader/system.img.raw ./tmp_system
sudo rsync -axHAWX --numeric-ids --info=progress2 --exclude=/proc ./tmp_system/ /mnt

Available tach settings

cat /sys/class/hwmon/hwmon2/pwm_rpm_table

Enable tach

echo 1 &gt; /sys/devices/pwm-fan/tach_enable
@TobidieTopfpflanze
TobidieTopfpflanze / decompile_dtb.sh
Last active November 7, 2024 06:08
Decompile DTB
# Decompile
dtc -I dtb -O dts -o devicetree.dts /boot/dtb/<your_devicetree_file_name>.dtb
# Compile
dtc -I dts -O dtb devicetree.dts -o <your_devicetree_file_name>.dtb
# Merge with DTBO
fdtoverlay -i modified-base.dtb -o modified-full.dtb /boot/tegra194-p3668-all-p3509-0000-user-custom.dtbo
# DTS from fs