################ bash ################ # Get space usage du -chs ./* | sort -rh du -kh --max-depth=1 | sort -rh # find files find [path] -name "lost+found" -prune -o -name "abc*.log.gz" -print0 ################ cpp ################ ## cpp heap memory checking sudo cat /proc/18594/maps |grep heap # cat the process memory 55da5171a000-55da5178a000 rw-p 00000000 00:00 0 [heap] 55da5178a000-55db1c7c3000 rw-p 00000000 00:00 0 [heap] 55db1c7c3000-55da5178a000= 3,406,008,320 around 3G mem. ## Then dump the heap memory to a file(example from UAT): dd if=/proc/29619/mem bs=1 skip=$((0x55db1c7c3000)) count=$((0x55db1c7c3000-0x55da5178a000)) status=none | strings > /tmp/heap_log.txt ## core dump in linux $ cat ulimit -c unlimited >> !/.bashrc $ cat kernel.core_pattern = core.%e.%p.%t >> /etc/sysctl.conf $ sudo sysctl --system ## check the compiler version with a given binary $ strings -a <binary/library> | grep "GCC: (" ################ docker compose ################ # up and run in background docker-compose up -d # stop --- will keep the data docker-compose stop # shutdown --- will remove the data docker-compose down -v # check service environment variables docker-compose run web env # check config --- this can print the real value of the variable docker-compose config ################ ssh ################ # check key on agent $ ssh-add -L $ ssh-add -l # add ssh key to agent $ ssh-add /path/to/your/key ################ conda ################ # create python env from file $ conda env create --file <env file> --channel default --channel conda-forge $ conda create --name <env name> python=3.8 # remove python env $ conda remove -n <env name> --all # update python env from file (your_env)$ conda env update --file <env file> --prune # output environment details (your_env)$ conda env export | grep -v "^prefix: " > environment.yml ################ pip ################ # pip upgrade package $ pip install <package> --upgrade # pip install from file $ pip install -r requirements.txt # pip output requirements file $ pip freeze > requirements.txt $ pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txt ################ ffmpeg ################ # extract subtitle from mkv # https://superuser.com/a/1649387/327808 # 0:s:0 --- input channel:subtitle channel:select channel $ ffmpeg -i your.mkv -map 0:s:0 your.srt # concat multiple mp4 # https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg $ cat mylist.txt $ file '/path/to/file.a' $ file '/path/to/file.b' $ ffmpeg -f concat -safe 0 -i mylist.txt -c copy c.mp4 # get images from video # https://stackoverflow.com/questions/40088222/ffmpeg-convert-video-to-images $ ffmpeg -i test.mp4 -vf fps=1/60 thumb%04d.png # get images for every minute # https://stackoverflow.com/a/40090033/2358836 $ ffmpeg -i in.mp4 -vf select='between(t,2,6)+between(t,15,24)' -vsync 0 out%d.png # get images in a range
Ubuntu 24.04 tools
- window tiling tool: https://gitlab.com/lundal/tactile
- system monitor tool: system-monitor next
Reference
[1]: Subramanian, V. (2024, June 11). NAS RAID Levels Explained: Which Level Is Right For You. Backblaze Blog | Cloud Storage & Cloud Backup. https://www.backblaze.com/blog/nas-raid-levels-explained-choosing-the-right-level-to-protect-your-nas-data/

Comments
Post a Comment