64 private links
Tilde (~) goes beyond just denoting the user's home directory in bash:
~fred/foo
# The subdirectory foo of the home directory of the user fred
~+/foo
# $PWD/foo
~-/foo
# ${OLDPWD-'~-'}/foo
~N
# The string that would be displayed by ‘dirs +N’
~+N
# The string that would be displayed by ‘dirs +N’
~-N
# The string that would be displayed by ‘dirs -N’
To print e.g. newline characters with bash printf which interprets the characters EVEN FROM A VARIABLE, do printf "%b" "my\nnewline\nvariable"
.
printf's %b
format specifier was meant specifically to replace echo -e
(actually, the XSI extension to echo which calls for special interpretation of the arguments by default. -e was never specified and is disallowed by POSIX.), and is identical in virtually every way including a few differences from $'...' and the format string argument to printf.
$ \curl -L https://get.rvm.io | bash -s stable --ruby
There's no error, it's a little hack to avoid using a curl shell alias if any exists.
This works too :
'curl' (...)
"curl" (...)
/usr/bin/curl (...)
command curl (...)
command -p curl (...)
To print every N th line, use
sed -n '0~Np'
It is written in the form first~step(print). For example, to copy every 5th line of oldfile to newfile, do
sed -n '0~5p' oldfile > newfile
sed -n '2~5p' oldfile
would print lines 2, 7, 12, 17, 22, 27, …, up to the end of the file.
Note: This approach requires GNU sed, as the first ~step address form is a non-portable extension. (Some old versions of GNU sed may require the 5~5 form as opposed to the 0~5 form.)
A detailed run-down of the differences between [ condition ] and [[ condition ]] in bash programming.
A script made to upload and share things, copying the share link to your clipboard, with simple logic.
Official repository for community contributed blocklets.
scripts and helper modules for i3blocks - but can presumably be adapted for polybar/yambar/lemonbar etc
Exhaustive list, with pros and cons, of access to nextcloud files.
Includes a little 'push' function to send stuff directly to your nextcloud folders which could be adapted to different use cases.
Not mentioned: S3 primary storage on Nextcloud
Uses an .ics
file (or a simulated file, through a HEREDOC, see solutions here ) to send it through curl as a data stream and thus bring it into Nextcloud.
Simple date-time parser, with nice unix-y philosophy.
Demo shows how it can be integrated into e.g. vim workflow for switching between different representations of dates,
and moving dates up, creating diaries with hundreds of entries, etc.
This bash tutorial presents a comprehensive list of useful string manipulation tips for bash scripting.
Bash-only, but really useful to avoid using sed or similar external programs.
Only writing to terminal what actually changed (akin to an adaptible screen paint / refresh)
files sorted by age, something akin to
fd --exec stat --printf='%Y\t%n\n' | sort -nr | head -1 | cut -f2
Shell for linux, running on python, aiming to be largely 'bash-like' (if not completely compatible afaik).
Could be intersting for more in-depth terminal work (semi-programmable) but probably large time investment to switch from other cozy homes like zsh.
Some useful shell ideas (bash, but many work with zsh).
Aliases, history functions, brace expansion etc
Using dmenu to directly seach through youtube results and add the resulting video into mpv.
Could be adapted to use my umpv
script, and remove some of the required programs.
I use custom script to store extra information for each task. The following script called note just create a markdown file named by task uuid:
#!/bin/env bash
NOTE_DIR=${HOME}/.task/notes
mkdir -p notes/
if [[ $# -eq 1 ]]; then
uuid=$(task _get $1.uuid)
note="${NOTE_DIR}/${uuid}.md"
vim $note || exit 1
task ${uuid} mod note:$(date --iso-8601=seconds) >/dev/null
else
vim ${NOTE_DIR}/buffer
fi
And then just set UDA and alias into taskrc:
uda.note.type=date
uda.note.label=Note
alias.note=execute "${HOME}/.task/hooks/note"
Now you can take a note with vim for each task if necessary:
task note 1
And you may also filter them by UDA:
task note.isnt:
And of course, the best way to manage markdown in vim is vimwiki!
An alternative is taskopen
In ZSH you can increase your productivity with aliases. This post explains 5 types of aliases that you should know. Boost your shell productivity now and make ZSH your own
The zsh shell offers countless options and features. Here are 5 ways to boost your efficiency from the command line.
Advanced aliases are interesting (e.g. aliases based on file ending)
What can I type at my shell (which happens to be bash) that will list all the commands that are recognized?
Also, does this differ by shell? Or do all shells just have a "directory" of commands they know about?
simplest version:
compgen -c
to list all commands