-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoneliners
99 lines (75 loc) · 6.48 KB
/
oneliners
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#! /bin/bash
# Shows the maximum frequency of all CPU cores in the system
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq | awk '{if (max<$0) max=$0}END{printf "%.2fGHz",max/1000000}'
# Maximum p7zip compression
# mmt4 + 1.5GB dictionary requires 32GB of free(!) RAM
7za a -mx=9 -myx=9 -mfb=273 -bt -slp -mmt4 -md=1536m -mqs archive_name.7z [files or/and directories]
# Maximum 7zz compression - requires a ton of RAM - 44GB maybe
7zz a -mx=9 -myx=9 -mfb=273 -bt -slp -mmt2 -md=3840m -mqs -stl -snl archive_name.7z [files or/and directories]
# Compute md5sum for all the files and subdirectoties' files in the current directory
find . -type f -print0 | xargs -0 [nocache] md5sum > output-file.md5
# My favourite rsync invocation (mind the trailing slashes!)
[ionice -c3] [nocache] rsync -avc --progress --preallocate --delete source/ /destination
# My favourite mkfs.ext4/mke2fs invocation
mkfs.ext4 -O ^huge_file,^has_journal /dev/device
# My favourite pv invocation
[nocache] pv -petrab /dev/source | tee /dev/destination | md5sum
# Too tired of remembering all the flags required to launch Google Chrome, originally 2018-03-06 22:47:33
env TZ=USA/Pacific FREETYPE_PROPERTIES=truetype:interpreter-version=35 chrome --disk-cache-dir=/tmp/.chrome-cache "$@"
# Extract a cpio archive
cpio -i -m -d -F "name.cpio"
# Create a cpio archive
find "directory" -depth | cpio -o -H crc -O "name.cpio"
# Poll/watch NVIDIA GPU temperature and power consumption (with proprietary NVIDIA drivers) - e.g. for XFCE generic monitor
nvidia-smi --query-gpu=temperature.gpu,power.draw --format=csv,noheader,nounits
# Compile VMWare kernel modules, 2009-08-30 05:35:03
vmware-modconfig --console --install-all
# online ext4 defrag for the current directory and all subdirs - no idea when I wrote it, around 2017 maybe?
# check the defrag script instead - works many times faster
find . -xdev -type f | while read filename; do filefrag "$filename" | egrep -v ": 1 extent|: 0 extents"; done | while read line; do fname=`echo "$line" | awk -F ': ' '{print $1}'`; e4defrag -v "$fname" | grep -v "e4defrag 1"; done
# dmesg show only serious messages without timestamps
dmesg -t --level=alert,crit,err,warn
# Build VirtualBox/NVIDIA modules with a custom kernel version
KERN_VER=$VERSION make -j16 # VirtualBox
SYSSRC=/lib/modules/$VERSION/source make -j16 # NVIDIA
# Not one-liners
# image2vvc - convert a bmp image to VVC somewhat losslessly (rgb to yuv420p10le is not lossless), 2021-04-27 19:39:38
for i in "$@"; do
xy=`identify "$i" | sed 's/.* \([0-9]*x[0-9]*\).*/\1/'` # ([[:digit:]]{1,5}x[[:digit:]]{1,5})
base="${i%.*}"
test -f "$base.vvc" && echo "Found $base.vvc, skipping" && continue
echo "File: $i Dimensions: $xy"
ffmpeg -hide_banner -loglevel error -nostats -s "$xy" -i "$i" -vframes 1 -pix_fmt yuv420p10le "$base.yuv"
# ffmpeg -s "$xy" -pix_fmt yuv420p10le -i "$base.yuv" -vframes 1 "$base.bmp"
# --verbosity 5
nice -20 ./vvencapp --input "$base.yuv" --size "$xy" --format yuv420_10 --frames 1 --preset slower --qp 0 --output "$base.vvc"
rm "$base.yuv"
touch -r "$i" "$base.vvc"
done
# vvc2bmp - decompress VVC to bmp, 2021-04-27 20:21:06
for i in "$@"; do
base="${i%.*}"
test -f "$base.bmp" && echo "Found $base.bmp, skipping" && continue
res=`./vvdecapp --bitstream "$i" --output "$base.yuv" | awk '/SizeInfo:/{print $4}'`
echo "File: $i Dimensions: $res"
ffmpeg -hide_banner -loglevel error -nostats -pix_fmt yuv420p10le -s "$res" -i "$base.yuv" "$base.bmp"
rm "$base.yuv"
done
# get current date/time in a sane format, e.g.
LANG=en_DK.UTF-8 date +"%x %X"
2022-08-09 02:54:42
# Set git repo files modification dates/times to the time they were commited (stolen somewhere - don't remember where)
git ls-tree -r --name-only HEAD | while read filename; do unixtime=$(git log -1 --format="%at" -- "${filename}"); touchtime=$(date -d @$unixtime +'%Y%m%d%H%M.%S'); touch -t ${touchtime} "${filename}"; done
# What I run daily after the Sun sets:
xcalib -v -blue 0.9 0 90 -alter
# This is to cancel it
xcalib -c
# Main PC Fedora 38 nodocs packages (too fat)
# 2024-01-01 16:17:36 UTC
# alsa-lib annobin-docs annobin-plugin-gcc atk atk-devel bison cups-devel exo flac-devel fontconfig freeglut-devel freetype-devel gcc gdk-pixbuf2 gdk-pixbuf2-devel git git-core-doc glib2 glibc gnutls gnutls-devel goldendict lame-libs lcms2-devel libaom-devel libcurl libcurl-devel libgpg-error libicu-devel libidn2 libtiff libtiff-devel libtool libvpx-devel libxml2 libxml2-devel libxslt-devel libxslt-devel.i686 libxslt-devel.x86_64 mpfr mpg123-devel ncurses nettle-devel nspr nss openssl-devel opus-devel pango-devel pcre2-devel pcre-devel pipewire pulseaudio-libs-devel source-highlight Thunar valgrind xfce4-panel xfce4-settings xfce4-terminal xfce4-weather-plugin xfdesktop zlib-devel
eatmydata dnf update --setopt='tsflags=nodocs' `cat ~/NODOCS`
# Elite laptop
# 2023-12-15 00:08:08
# libaom-devel alsa-lib-devel annobin-docs bind-libs bison cups-devel curl expat fftw-libs-single flac-devel fontconfig freetype-devel gcc gdk-pixbuf2 gdk-pixbuf2-devel git git-core-doc glib2 glibc gnutls gnutls-devel gparted hwloc-libs krb5-devel lame-libs libcurl libgpg-error libtiff-devel libtool libtraceevent libxml2 libxslt libxslt-devel libXt libXt-devel luajit mpg123-devel ncurses nettle-devel nspr nss openssl opus-devel pcre2-devel pcre-devel pulseaudio-libs-devel ristretto SDL2 source-highlight Thunar xfce4-panel xfce4-settings xfce4-terminal xfdesktop zlib-devel
# Common list
# alsa-lib alsa-lib-devel annobin-docs annobin-plugin-gcc atk atk-devel bind-libs bison cups-devel curl exo expat fftw-libs-single flac-devel fontconfig freeglut-devel freetype-devel gcc gcc-c++ gdk-pixbuf2 gdk-pixbuf2-devel git git-core-doc glib2 glibc gnutls gnutls-devel goldendict gparted hwloc-libs json-glib-devel krb5-devel lame-libs lcms2-devel libaom-devel libcurl libcurl-devel libgpg-error libicu-devel libidn2 libstdc++-devel libtiff libtiff-devel libthai-devel libtool libtraceevent libvpx-devel libxml2 libxml2-devel libxslt libxslt-devel libxslt-devel.i686 libxslt-devel.x86_64 libXt libXt-devel luajit mpfr mpg123-devel ncurses nettle-devel nspr nss openssl openssl-devel opus-devel pango-devel pcre2-devel pcre-devel pipewire pulseaudio-libs-devel ristretto SDL2 source-highlight Thunar valgrind xfce4-panel xfce4-settings xfce4-terminal xfce4-weather-plugin xfdesktop zlib-devel libnotify-devel libgit2-devel libao-devel libdatrie-devel cryptsetup eb-devel gtest-devel libsndfile-devel nvme-cli openvpn python3-setuptools wireguard-tools xorg-x11-proto-devel