Add all other stuff

This commit is contained in:
Jean-Claude 2023-10-29 20:00:59 +01:00
parent 772585810d
commit 73a765e9c3
Signed by: jeanclaude
GPG Key ID: 8A300F57CBB9F63E
19 changed files with 291 additions and 0 deletions

4
Irc/libera.md Normal file
View File

@ -0,0 +1,4 @@
# Libera.Chat
## Find Channels
- Use Bot `alis`: `/msg alis LIST *<SEARCH_TERM>*`

6
Router/OpenWrt.md Normal file
View File

@ -0,0 +1,6 @@
# OpenWrt
- scp gives `ash: /usr/libexec/sftp-server: not found`
> Use `-O` flag
- Get public IP: `dig +short myip.opendns.com @resolver1.opendns.com`

6
commands.md Normal file
View File

@ -0,0 +1,6 @@
# Commands
List of random commands
- Add $20$ to all branch names where the names does not start with the full year:
- `git for-each-ref refs/heads --format "%(refname:short)" | grep -E "^[0-9]{6}_.*" | xargs -n 1 -I % git branch -m % 20%`

7
ctf.md Normal file
View File

@ -0,0 +1,7 @@
# CTF
## General Information about Binary
- `checksec --file <BINARY>`
## PWN-Tools
- Create from template: `pwn template <BINARY> > exploit.py`

View File

@ -5,3 +5,12 @@
- Run script within a container `docker exec -i <containerName> bash < <scriptPath>`
- Update all images: `docker images | grep -v REPOSITORY | awk '{print $1}'| xargs -L1 docker pull`
## Networking
### Access Hosts
- Add
- Connect to hosts's localhost using: `172.17.0.1`
### Intercontainer Communication
- use docker name inside container

9
find.md Normal file
View File

@ -0,0 +1,9 @@
# Find
- Include pipe in exec:
`-exec sh -c "zcat {} | agrep -dEOE 'grep' " \;`
`find -name 'file_*' -follow -type f -exec zcat {} \; | agrep -dEOE 'grep'`
- Convert markdown files in subdirectory to pdf:
`find . -regextype sed -regex ".*/[0-9]*-sol.md" -exec sh -c 'cd $(dirname $0) && pandoc -V geometry:margin=1in --pdf-engine=xelatex --variable mainfont="DejaVu Serif" -o $(basename $0).pdf $(basename $0)' {} \;`

82
grub.md Normal file
View File

@ -0,0 +1,82 @@
# Grub
- Get Menu number:
```
#!/bin/bash
# NAME: grub-display-lite.sh
# PATH: $HOME/bin
# DESC: Written for AU Q&A: https://askubuntu.com/q/1019213/307523
# DATE: Mar 26, 2018.
# NOTE: "lite" version written for Ubuntu Server and Lubuntu which do
# not have `dialog` installed by default. `whiptail` is used
# instead. Nice consequences are better resolution, mouse scroll
# wheel and copy to clipboard support.
# $TERM variable may be missing when called via desktop shortcut
CurrentTERM=$(env | grep TERM)
if [[ $CurrentTERM == "" ]] ; then
notify-send --urgency=critical "$0 cannot be run from GUI without TERM environment variable."
exit 1
fi
# Version without upstart and recovery options displayed
awk -F\' '/menuentry / { print i++, $2}' /boot/grub/grub.cfg \
| grep -v upstart | grep -v recovery > ~/.grub-display-menu
# Version with upstart and recovery options displayed
#awk -F\' '/menuentry / { print i++, $2}' /boot/grub/grub.cfg \
# > ~/.grub-display-menu
MenuArr=()
while read -r line; do
MenuNmbr=${line%% *}
MenuName=${line#* }
MenuArr+=($MenuNmbr "$MenuName")
done < ~/.grub-display-menu
rm ~/.grub-display-menu
LongVersion=$(grub-install --version)
ShortVersion=$(echo "${LongVersion:20}")
DefaultItem=0
while true ; do
Choice=$(whiptail \
--title "Use arrow, page, home & end keys. Tab toggle option" \
--backtitle "Grub Version: $ShortVersion" \
--ok-button "Display Grub Boot" \
--cancel-button "Exit" \
--default-item "$DefaultItem" \
--menu "Menu Number ----------- Menu Name ----------" 24 76 16 \
"${MenuArr[@]}" \
>/dev/tty)
clear
if [[ $Choice == "" ]]; then break ; fi
DefaultItem=$Choice
for (( i=0; i < ${#MenuArr[@]}; i=i+2 )) ; do
if [[ "${MenuArr[i]}" == $Choice ]] ; then
i=$i+1
MenuEntry="menuentry '"${MenuArr[i]}"'"
break
fi
done
TheGameIsAfoot=false
while read -r line ; do
if [[ $line = *"$MenuEntry"* ]]; then TheGameIsAfoot=true ; fi
if [[ $TheGameIsAfoot == true ]]; then
echo $line
if [[ $line = *"}"* ]]; then break ; fi
fi
done < /boot/grub/grub.cfg
read -p "Press <Enter> to continue"
done
exit 0
```

View File

@ -27,3 +27,8 @@
- Create mailboxes: `mbsync -c ~/.config/isync/mbsyncrc <NEW_MAIL>`
- Create missing folder: `mkdir ~/.local/share/mail/<NEW_MAIL>/cur`
## Neomutt
- Tag single message: `t`
- Tag thread: `<ESC>t`
- Apply function to all tagged messaged: `;t`
- Move to folder: `s`

7
matlab.md Normal file
View File

@ -0,0 +1,7 @@
# Matlab
## Install
- Fix installer by disabling `libfreetype.so.6`
- <https://ch.mathworks.com/matlabcentral/answers/364551-why-is-matlab-unable-to-run-the-matlabwindow-application-on-linux>
- Preferences not beeing saved: <https://ch.mathworks.com/matlabcentral/answers/1806255-why-aren-t-my-preferences-saving>
- All other issues are described on arch wiki

3
pacman.md Normal file
View File

@ -0,0 +1,3 @@
# Pacman
- Print no version info: Add `q` (quiet)

View File

@ -2,8 +2,12 @@
## Exiftool
- show available previews: `exiftool -preview:all <myImage>`
- Extract embedded jpg: `exiftool -b -<PREVIEW_TYPE> -w out.jpg <myImage>`
## Add IPTC
- `exiv2 -M "add Iptc.Application2.Contact jeanggi90@gmail.com" -M "add Iptc.Application2.Copyright Jean-Claude Graf" <img>`
## Make larger edge equals certain size: `convert <inImage> -resize 64x64\> <outImage>`
- Rename according to datetime `exiv2 -r'%Y_%m_%d__%H_%M_%S' -F <IMAGE_PATHS>`
- Rename according to datetime including file structure: `exiftool -r '-FileName<DateTimeOriginal' -d %Y/%m/%d/%%f%%-c.%%e <IMAGE_PATHS>`

34
pinenote.md Normal file
View File

@ -0,0 +1,34 @@
# PineNote
## Enter Load Mode
- Connect using USB cable
- Monitor USB devices: `watch -n 1 lsusb`
- Place device upside down
- Put pen on device as marked
- Power on device
- Monitor `lsusb` for `Fuzhou Rockchip Electronics Company USB download gadget`
- My require pressing power multiple times
- If successful, `rkdeveloptool list` should output `DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=103 Loader`
## Enter UART
- Connect using USB cable via UART
- Enter `picocom /dev/ttyUSB0 -b 1500000 -l`
- Reboot from Android
- Hold `CTRL+c` in picom terminal until `=> <INTERRUPT>` appears
## Enter Fastboot
- Enter UART
- Enter `fastboot usb 0`
- Disconnect the UART adapter and connect the device directly
## Boot to Linux
- Enter UART
- Enter `sysboot ${devtype} ${devnum}:11 any ${scriptaddr} /boot/extlinux.conf`
## Linux
- Available Users:
- `root:root`
- `alarm:alarm`
## TODO
`/etc/systemd/logind.conf.d/*.conf` seems to be ignored, using `/etc/systemd/logind.conf` instead

25
python.md Normal file
View File

@ -0,0 +1,25 @@
# Python
- Disable request for wallet: `python3 -m keyring --disable`
- <https://stackoverflow.com/a/68760190/5464989>
## Virtualenv
- Of specific version:
- Make sure version is available in `/usr/bin/`
- Create env: `virtualenv -p <version> .venv
## Other
- Show packages imported at startup: `python -X importtime -m <pythonFile>`
- Useful to verify lazy loading
## Profiling
- Run profiler: `python -m cProfile -o out.out -- <FILE> <ARGS>`
- Visualize as flow chart: `python -m gprof2dot -f pstats out.out | dot -Tpng -o out.png `
- Deps: [gprof2dot](https://github.com/jrfonseca/gprof2dot)
- By default, excluded negligible nodes/edges. Set `--node-thres 0` (`-n`) and `--edge-thres 0` (`-e`) to include all
- Visualize as starburst (interactively): `python -m snakeviz out.out`
- Deps: [snakeviz](https://jiffyclub.github.io/snakeviz/)
### Profile single function/method
- Import `from profilehooks import profile`
- Add `@profile` to function to profile

21
rss.md Normal file
View File

@ -0,0 +1,21 @@
# RSS
## Feed of Pages
- Search of:
- `rss`
- `xml`
- `atom`
## Feed of Youtube
- For Channel: <https://www.youtube.com/feeds/videos.xml?channel_id=> + ID
- The ID is the value of the key `externalId` found in the source of the channels site
- For Playlist: <https://www.youtube.com/feeds/videos.xml?playlist_id=> + ID
- ID comes in the URL after <https://www.youtube.com/playlist?list=>
## Feed of Github
- Commits to repo: <https://github.com/OWNER/REPO/commits.atom>
- Commits to certain branch: <https://github.com/OWNER/REPO/commits/BRANCH.atom>
- Releases of a repo: <https://github.com/OWNER/REPO/releases.atom>
- Activities of user: <https://github.com/OWNER.atom>

37
rsync.md Normal file
View File

@ -0,0 +1,37 @@
# Rsync
# Status Meaning
> Taken from <https://stackoverflow.com/a/36851784/5464989>
```
YXcstpoguax path/to/file
|||||||||||
||||||||||╰- x: The extended attribute information changed
|||||||||╰-- a: The ACL information changed
||||||||╰--- u: The u slot is reserved for future use
|||||||╰---- g: Group is different
||||||╰----- o: Owner is different
|||||╰------ p: Permission are different
||||╰------- t: Modification time is different
|||╰-------- s: Size is different
||╰--------- c: Different checksum (for regular files), or
|| changed value (for symlinks, devices, and special files)
|╰---------- the file type:
| f: for a file,
| d: for a directory,
| L: for a symlink,
| D: for a device,
| S: for a special file (e.g. named sockets and fifos)
╰----------- the type of update being done::
<: file is being transferred to the remote host (sent)
>: file is being transferred to the local host (received)
c: local change/creation for the item, such as:
- the creation of a directory
- the changing of a symlink,
- etc.
h: the item is a hard link to another item (requires
--hard-links).
.: the item is not being updated (though it might have
attributes that are being modified)
*: means that the rest of the itemized-output area contains
a message (e.g. "deleting")
```

21
system.md Normal file
View File

@ -0,0 +1,21 @@
# System Stuff
## Cache
### Word
- Can have two meanings:
- In assembly: 2 bytes
- In systems: bitwith (32b or 64b)
### Page
- Granularity of paging.
- 1024 bytes
### Cache Line/Block
- Number of consecutive bytes cached together to exploit spacial locality
- 64 bytes
### Inclusive, Exclusive, Non-Inclusive
- If all blocks in the higher level cache are also present in the lower level cache, then the lower level cache is said to be inclusive of the higher level cache.
- If the lower level cache contains only blocks that are not present in the higher level cache, then the lower level cache is said to be exclusive of the higher level cache.
- If the contents of the lower level cache are neither strictly inclusive nor exclusive of the higher level cache, then it is called non-inclusive non-exclusive (NINE) cache.

4
virtualbox.md Normal file
View File

@ -0,0 +1,4 @@
# Virtualbox
## Guest Edition
- Install `virtualbox-guest-iso`

7
x86_64.md Normal file
View File

@ -0,0 +1,7 @@
# x86_64
## User Address Space:
- 0x0000000000000000 to 0x00007FFFFFFFFFFF (0 to 128 TB)
## Kernel Address Space:
- 0xFFFF800000000000 to 0xFFFFFFFFFFFFFFFF