This isn't really a guide to anything in particular, I just wanted an easily accessible reference for all the things I'm sick of wading through google results for, or otherwise seem to need help remembering. I've put it here in case someone else might find this helpful. I'll likely be adding to this as I find myself repeatedly googling things.
~/.config/khotkeysrc
. There should be a line that looks like: Uuid={77575b17-36d6-4b4e-b01f-2f1156e38583}
. Copy everything inside the curly braces, including the braces themselves.$ kwriteconfig5 --file ~/.config/kwinrc --group ModifierOnlyShortcuts --key Meta "org.kde.kglobalaccel,/component/khotkeys,org.kde.kglobalaccel.Component,invokeShortcut,<YOUR UUID HERE>"
$ qdbus org.kde.KWin /KWin reconfigure
pipeline | |
command | command2 | uses the output of one command as the input to the next |
command > file | saves the output of a command to a file |
command < file | uses a file as the input to a command |
command < fileA > fileB | will therefore run command with the contents of fileA as the input, and save the output to fileB |
command <<< "string or $variable" | will use the string or variable as the input to a command, the same as < file |
variables | |
variable=value | assigns a variable |
$variable | references it |
$(command) | lets you treat the output of a command like a variable reference |
$((number+variable)) | does the same thing for integer math expressions. |
$(( $(command) )) | This can also just convert strings into integers. |
"te$(command)xt" | Both can be inserted into strings. |
"some $variable text" | Both of these are valid ways to insert a variable into a string. |
grep | |
-v | Inverts it, so matches are excluded |
-E "/regex/" | Lets you use regex |
cut | |
-d 'string' | Determines the delimiter string, the default is the TAB character |
-f n | Specifies a field to output, delimited by -d |
sed 's/ */ /g' | cut -d ' ' | Piping your thing through this helps with parsing a lot of Linux commands that output tabular data |
sed | |
sed "s/regex/replacement/flags" | The basic sed replacement command, checks a line of input against the provided regular expression regex and replaces matches with replacement . |
sed "s/a/b/;s/c/d/" | Multiple sed commands can be strung together in one, like so. |
sed "s/a/b/g" | The g flag makes sed replace all occurences of the pattern, not just the first |
sed "s/a/b/<number>" | Insert any number to tell sed to replace only that occurence. Counts from 1. Theoretically, s/a/b/ is the same as s/a/b/1 . |
sed "s/a/b/i" | GNU extension - Match case-insensitively. |
sed "s/^a/b/" | Require that a match be at the beginning of the line. |
sed "s/a$/b/" | Require that a match be at the end of the line. |
sed "s/^a$/b/" | Require that a match be both at the beginning and the end - in other words, require that a match be the entire line. |
misc | |
xrandr --output <display name> --brightness <brightness> | Janky software-side display brightness setting with xrandr |
wget "https://example.com/file.zip" -O temp.zip; unzip temp.zip; rm temp.zip | Bash one-liner to unzip a file from the internet to the current directory |
yt-dlp -x --audio-format flac --audio-quality 0 -P ~/Music/Library/ -o "%(uploader)s - %(title)s.%(ext)s" | My standard yt-dlp command for ripping music from Youtube and Soundcloud. I have an alias for this so I don't have to write it out every time. |
alias myalias="command go here" | Set an alias in bash. Put this in your .bashrc or similar to make it permanent. |
<td>
element not to wrap by adding the white-space:nowrap;
CSS property to it.table-layout
CSS property to fixed
to force the the columns to be equal widths.date()
function in PHP returns date information. The first argument is a format string and the second is an optional integer for a Unix timestamp. The valid format characters as of PHP 8 can be found here.strtotime()
function does the reverse operation, converting date strings to Unix timestamps. Storing dates as Unix timestamps and converting when needed is recommended.I don't actually have a solution for this one, I just wish there was a resource for looking up the lyrics to songs and looking up songs by their lyrics that wasn't an SEO leech site.