Linux nice

On Linux, the nice command has an abbreviated form without -n, eg you can do:

nice -3 something

It can cause a little confusion at times that the -3 is equivalent to -n +3 not -n -3.

It is worth adding that there is no nice +3 or even nice 3. Furthermore, UNIX nice only has the -n form.

As an example, the the two lines below print the default nice level (eg 5) and the default plus one (eg 6):

yes >/dev/null & ps -o %n $! && kill $!
nice -1 yes >/dev/null & ps -o %n $! && kill $!
Posted in Uncategorized | Leave a comment

Linux System Load

What a fine overview of load information on Linux systems by Brendan Gregg:

http://www.brendangregg.com/blog/2017-08-08/linux-load-averages.html

Thanks to the author for putting this out

Posted in Uncategorized | Leave a comment

Markdown Preview

In some contexts, such as readme files rendered by GitHub, I would like to preview my Markdown changes before pushing them

Precisely for this Joe Esposito wrote a tool that starts a local web server to render Markdown files:

https://github.com/joeyespo/grip

Posted in Uncategorized | Leave a comment

MacBook Pro Touch Bar in MacVim

To my surprise, this is enabled and working in my version 8.2.1719 MacVim. The below adds a run icon to the touch bar that triggers a custom command:`

:an TouchBar.Run :!make && ./run<Enter>

And the below deletes this item:

:an disable TouchBar.Run

For documentation, start in gui_mac.txt (runtime directory of MacVim installation).

Posted in Uncategorized | Leave a comment

PIP 403 Error (JSON Utils)

I got ‘Error 403: SSL is required’ today while trying to install JsonUtils using PIP. I was able to install directly from sources by passing the GitHub URL to PIP install.

screenshot-2020-03-04-at-10.42.30

Posted in Uncategorized | Leave a comment

MPEG-4 Audio to WAV on Mac

afconvert -d LEI24 a.m4a a.wav

Thanks to author of:

How to Use Afconvert

Posted in Uncategorized | Leave a comment

Git SSH Instead of HTTPS

This worked to use SSH over port 443:

git clone ssh://git@ssh.github.com:443/company/one_big_repo.git

where previously HTTPS would give me ‘hung up unexpectedly’:

error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

Posted in Uncategorized | Leave a comment

Environment Modules in macOS

Requires TCL headers, so first build and install TCL 8.5.9 to match version in my macOS 10.14:

./configure --prefix=/usr/local
sudo make all install

Then build and install modules 4.2.2:

./configure --prefix=/usr/local/Modules/4.2.2 --without-x --with-tcl=$HOME/tcl8.5.9/macosx
make
sudo make install

Note that you specify the build directory not install directory (which would be /usr/local in this case). That’s because configure is looking for tclConfig.sh.

References:

Posted in Uncategorized | Leave a comment

Mac PyAudio Using pip

In my quest to avoid install Homebrew or MacPorts, I ended up with the following steps to install pyaudio using pip

1. Place my a binary of PortAudio in /usr/local/lib. This is the 2016 ‘stable’ version v190600_20161030 that Homebrew still appears to use as well. I didn’t try compiling it from scratch as it requires Mac SDK 10.9 or older.

2. My binary was compiled on another system, and had the wrong LC_ID_DYLIB path. To correct that I did: sudo install_name_tool -id /usr/local/lib/libportaudio.dylib /usr/local/lib/libportaudio.dylib.

3. Place the corresponding pa_mac_core.h in /usr/local/include

4. Upgrade pip: sudo pip install --upgrade pip

5. Install PyAudio: sudo pip install --global-option=build_ext --global-option=-L/usr/local/lib --global-option=-I/usr/local/include pyaudio.

Thanks to Stack Overflow for pointing me to the global-option pip flags. Like another user I wondered why pip wouldn’t pick up /usr/local for dependencies by default.

https://stackoverflow.com/questions/33513522/when-installing-pyaudio-pip-cannot-find-portaudio-h-in-usr-local-include

Thanks also to author of the following, which was useful in reading up on the relevant parts of the Mac dynamic linker:

View at Medium.com

Posted in Uncategorized | Leave a comment

Simple macOS Windows Tiling

Shell script to stack all active application windows on top each other in one of two possible layouts. The 2-column layout has an 80-character full height terminal on the left and everything else on the right of it. The 2-column layout has an 80-character full height terminal in the middle and everything else on either side of it.

https://sourceforge.net/projects/simple-macos-window-tiling

Posted in Uncategorized | Leave a comment