The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,640 other followers

Archive for the ‘bash’ Category

pure-bash-bible/README.md – book for doing things in bash without external tools

Posted by jpluimers on 2018/09/21

[WayBack] pure-bash-bible/README.md at master · dylanaraps/pure-bash-bible · GitHub:

The goal of this book is to document known and unknown methods of doing various tasks using only built-in bash features. Using the snippets from this bible can help remove unneeded dependencies from scripts and in most cases make them faster. I came across these tips and discovered a few while developing neofetchpxltrm and other smaller projects.

The snippets below are linted using shellcheck and tests have been written where applicable. Want to contribute? Read the CONTRIBUTING.md. It outlines how the unit tests work and what is required when adding snippets to the bible.

See something incorrectly described, buggy or outright wrong? Open an issue or send a pull request. If the bible is missing something, open an issue and a solution will be found.

Via:

jeroen

Posted in *nix, *nix-tools, bash, bash, Development, Power User, Scripting, Software Development | Leave a Comment »

bash: `printf` supports `\e` just like `echo -e` does

Posted by jpluimers on 2017/11/07

Learned a few things when modifying https://github.com/gkotian/gautam_linux/blob/master/scripts/colours.sh

Note: `printf` supports emitting `ESC` (ASCII character `\033` aka `27` aka `0x1B`)as `\e` the same way that `echo` does

https://linux.die.net/man/1/printf
https://linux.die.net/man/1/echo

Format strings are at https://linux.die.net/man/3/printf
%-10s means left adjusted (aligned) string of length 10

–jeroen

via:

I was investigating how the colour definitions on my OpenSuSE system actually work internally so I added some extra output: ${TYPE} and ${COLOUR}.

Source: Show type and colour definition in addition to the rendered colour. by jpluimers · Pull Request #5 · gkotian/gautam_linux

Posted in *nix, *nix-tools, bash, bash, Development, Linux, openSuSE, Power User, Scripting, Software Development, SuSE Linux | Leave a Comment »

nojhan/liquidprompt: A full-featured & carefully designed adaptive prompt for Bash & Zsh

Posted by jpluimers on 2017/10/05

Wow: nojhan/liquidprompt: A full-featured & carefully designed adaptive prompt for Bash & Zsh

This is really useful!

via:

Sort of tanslated from the first “via” (note that “mit Alles und Scharf” is hard to translate; it’s somewhere between “everything but the kitchen sink, but done right” and “right on the money”):

Bash Prompt Overkill: https://github.com/nojhan/liquidprompt is a Bash “Prompt doing it all right”-extension, which doesn’t care how much any feature costs as we have cores, gigabytes and SSD.

Liquid Prompt automagically recognises context and enables a plethora of features in the prompt when needed based on that context.

It’s like pixie dust for your prompt.

You can configure everything, but you don’t have to: the out of the box experience is already like pixie dust for your prompt.

It works on OS X too and is part of homebrew:

$ brew install liquidprompt
==> Using the sandbox
==> Downloading https://github.com/nojhan/liquidprompt/archive/v_1.11.tar.gz
==> Downloading from https://codeload.github.com/nojhan/liquidprompt/tar.gz/v_1.11
######################################################################## 100.0%
==> Caveats
Add the following lines to your bash or zsh config (e.g. ~/.bash_profile):
  if [ -f /usr/local/share/liquidprompt ]; then
    . /usr/local/share/liquidprompt
  fi
If you'd like to reconfigure options, you may do so in ~/.liquidpromptrc.
A sample file you may copy and modify has been installed to
  /usr/local/share/liquidpromptrc-dist
Don't modify the PROMPT_COMMAND variable elsewhere in your shell config;
that will break things.
==> Summary
🍺  /usr/local/Cellar/liquidprompt/1.11: 7 files, 125.6K, built in 3 seconds
[jeroenp:~/Versioned] 10s $

–jeroen

Read the rest of this entry »

Posted in *nix, *nix-tools, Apple, bash, bash, Development, Mac OS X / OS X / MacOS, Power User, Scripting, Software Development | Leave a Comment »

youtube-dl – saving both audio and video without keeping intermediate files seems impossible

Posted by jpluimers on 2017/09/14

Just in case someone has a better alternative than youtube-dl alias:

alias youtube-dl-audio-and-video='youtube-dl --keep-video --extract-audio --audio-quality 0 --audio-format mp3'

It extracts the audio and keeps the video.

The result is that also all intermediate downloads are being kept.

So even after studying the README extensively the only alternative seems to be a double download like this:

youtube-dl-audio-and-video() { youtube-dl --extract-audio --audio-quality 0 --audio-format mp3 $1; youtube-dl $1; }

–jeroen

Posted in *nix, *nix-tools, bash, bash, Development, Power User, Scripting, Software Development | Leave a Comment »

opensuse – How to run my script after SuSE finished booting up? – Unix & Linux Stack Exchange

Posted by jpluimers on 2017/04/21

For future research: opensuse – How to run my script after SuSE finished booting up? – Unix & Linux Stack Exchange

Reason? Want to show the output of this as the last boot sequence line:

hostname
ip route
echo
ip address | grep -w 'UP\|flags\|inet\|inet6'
echo more detailed info through "ip address" and "ip route"
cat /etc/resolv.conf | grep nameserver

–jeroen

Posted in *nix, *nix-tools, bash, Linux, openSuSE, Power User, SuSE Linux, Tumbleweed | Leave a Comment »

 
%d bloggers like this: