OSI-Model

1 Physical - data cables 2 Data - Switching, MAC addresses 3 Network - IP addresses, routing 4 Transport - TCP/UDP 5 Session - Session management 6 Presentation - WMV, JPEG, MOV 7 Application - HTTP, SMTP Please do not throw sausage pizza away

19 December 2024 · 1 min

Over The Wire Wargames Solutions

Bandit Passwords PW for bandit4: pIwrPrtPN36QITSp3EQaw936yaFoFgAB bandit5: koReBOKuIDDepwhWk7jZC0RTdopnAYKh bandit6: DXjZPULLxYr17uwoI01bNLQbtFemEgo7 bandit7: HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs bandit8: cvX2JJa4CFALtqS87jk27qwqGhBM9plV bandit9: UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR bandit10:truKLdjsbJ5g7yyJ2X2R0o3a5HQJFuLk bandit11:IFukwKGsFW8MOq3IRFqrxE1hxTNEbUPR bandit12:5Te8Y4drgCRfCx8ugdwuEX8KFC6k2EUu bandit13:8ZjyCRiBWFYkneahHwxCv3wb2a1ORpYL bandit14:4wcYUJFw0k0XLShlDzztnTBHiqxU3b3e bandit15:BfMYroe26WYalil77FoDi9qh59eK5xNr

19 December 2024 · 1 min

PDF-Tools

PDF arranger Can make booklets. Arrange, delete, add pages to pdfs. pdfbook Use pdfbook2 from texlive-extra-utils to create a booklet. pdfjam If some pdf program complains about different sized pages, use pdfjam to make them all the same size pdfjam --outfile out.pdf --paper a5paper in.pdf Jpdf Tweak Swiss army knife for pdfs. Watermarks, page numbering, bookmarks, attachments, document info, encryption, etc. OCRmyPDF OCR on images and pdfs. ocrmypdf no_ocr.pdf ocr.pdf --sidecar ocr.txt -l deu+eng --force-ocr If –force-ocr is issued, then all pages will be rasterized to images, discarding any hidden OCR text, rasterizing any printable text, and flattening form fields or interactive objects into their visual representation. This is useful for redoing OCR, for fixing OCR text with a damaged character map (text is selectable but not searchable), and destroying redacted information. ...

19 December 2024 · 2 min

Shrinking .img files on Linux

Context of the problem: Having a myimage.img bigger then the hardware support (if it is smaller there should be no problem; however, using the same strategy, you can better fit the image in the hardware support). The secret is to use standard Linux tools and instruments: GParted, fdisk and truncate. Requirements: A Linux PC The .img you want to shrink (myimage.img in this example) Creating loopback device: GParted is an application typically used to manage partition tables and filesystems. In order to shrink the image, GParted is going to be used along the first part of the answer. ...

19 December 2024 · 4 min

Systemd targets

Target Description halt Shut down all services and halt the system poweroff Shut down all services and power off the system shutdown Shut down the system normally rescue Single-user (root) mode for maintenance and recovery functions. It mounts all file-system but does not start any networking related service or function. multi-user Multi-user command line mode for regular tasks. It starts all essential and custom services and provides the CLI prompt for login and work. graphical Same as the multi-user.target but also includes GUI. A user can use the graphical desktop environment to login and work or can use regular command line interface. reboot Reboot the system normally. default Default target to boot the system. Usually set either to multi-user.target or graphical.target. emergency Start an emergency shell and mount only root file-system. Other file-system and networking remain disabled. hibernate Save the running state of the system to the hard disk and power off the system. When the system is power on again, the systemd restores the saved state. suspend Same as the hibernate except the system state is saved in the memory and power to the memory is not turned off.

19 December 2024 · 1 min

Useful Linux commands and applications

Commands (May not be preinstalled on your distro) gdu - disk usage in go with multiprocessor (alternative: ncdu) fd - better find wavemon - analyse wifi pv and progress - watch progress of a command hardinfo - hardwareinfo sshfs - mount remote servers Crop multiple fotos for i in *.png; do convert -crop aaaxbbb+ccc+ddd "$i" out/"$i"; done Where: aaa is the x offset from the left bbb is the y offset from the right ccc is the horizontal size of the output image ddd is the vertical size of the output image All in pixels, you can get them by selecting just one image in gimp and looking at the bottom bar for the values ;) ...

19 December 2024 · 3 min

Common GCC Attributes

Function attributes fallthrough The fallthrough attribute with a null statement serves as a fallthrough statement. It hints to the compiler that a statement that falls through to another case label, or user-defined label in a switch statement is intentional and thus the -Wimplicit-fallthrough warning must not trigger. For compatibility with GCC and Clang you can also use // fall through or // fallthrough. switch(cond) { case 1: bar(1); __attribute__((fallthrough)); case 2: … } deprecated & deprecated (msg) The deprecated attribute results in a warning if the function is used anywhere in the source file. This is useful when identifying functions that are expected to be removed in a future version of a program. The warning also includes the location of the declaration of the deprecated function, to enable users to easily find further information about why the function is deprecated, or what they should do instead. ...

13 August 2024 · 4 min

What is the difference between `char a[]` and `char *p`

The Array version: char a[] = "string"; Creates an array that is large enough to hold the string literal string, including its NULL terminator. The array string is initialized with the string literal string. The array can be modified at a later time. Also, the array’s size is known even at compile time, so sizeof operator can be used to determine its size. The pointer version: char *p = "string"; Creates a pointer to point to a string literal “string”. This is faster than the array version, but string pointed by the pointer should not be changed, because it is located in a read only implementation-defined memory. Modifying such an string literal results in Undefined Behavior. ...

28 February 2024 · 3 min