Skip to content

Instantly share code, notes, and snippets.

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

Tobi TobidieTopfpflanze

😅
Hey, Tobi here!
View GitHub Profile
@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 / 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;
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 / 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

@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 / 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