Wednesday, May 9, 2018

Lilypond in Debian Stretch

lilypond wasn't included in stretch, but has been backported

add

deb http://ftp.debian.org/debian stretch-backports main

to /etc/apt/sources.list, and then

sudo apt update
sudo apt-get -t stretch-backports install lilypond



Friday, April 20, 2018

To install a new version of Racket on an old version of Debian

Running Debian 8 which has Racket 2.1.

Trying to work through

http://io.livecode.ch/learn/gregr/icfp2017-artifact-auas7pp

for which there is a Racket Package

2.1 is not good enough, need Racket 2.6

Check out:

https://backports.debian.org/Instructions/

$ su

# echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list

# apt update

# apt-get -t jessie-backports install racket

Now have Racket 2.7, which is good enough.

Friday, August 4, 2017

grep just highlight

https://stackoverflow.com/questions/7393906/highlight-text-similar-to-grep-but-dont-filter-out-text#7394821

Trick is to use ^ to every line with a start-of-line. Since that's unprintable it won't get highlighted.

So to list all the files with arista in the name, but highlight the objects:

find . -name "*arista*" | grep -E '^|\.o|.so'

Friday, May 19, 2017

Find .c or .h or .py files

You can use a regular expression with find:

find . -regex '.*cisco.*\.\(c\|h\|py\)'

finds all cisco-related .c .h or .py files.

Monday, April 24, 2017

Friday, February 24, 2017

How to fix a spelling mistake in lots of files

First, is it all version controlled? 
And are any of the files currently in editor buffers? Close if so.

There are two different versions of rename

the perl-rename that I was expecting

$ rename 's/monkey/reproducer/g' *monkey*

and the rename from util-linux 2.28.2 that's actually on my Fedora box

$ rename monkey reproducer *monkey*

need to do this in all affected directories, there's probably something you can do with find if there are lots

and then to change the text in all the files (recursive)

$ grep -rl monkey . | xargs sed -i 's/monkey/reproducer/g' 

finally change it in .bash_history too

sed -i 's/monkey/reproducer/g' ~/.bash_history

note that this will corrupt the history of all the commands you just typed.

Tuesday, February 14, 2017

rsync and explainshell

My current favourite rsync invocation is:

$ DIR=/home/jla/stuff

$ rsync -Phavz --stats remote:$DIR/  $DIR

and my current favourite way of figuring out what the options mean is:

http://explainshell.com/explain?cmd=rsync+-Phavz+--stats

http://explainshell.com/explain?cmd=rsync+-Phavz+--stats+remote%3A%24DIR%2F+%24DIR

Although it doesn't mention the crucial trailing slash on the source directory, which means that you end up copying /home/jla/stuff/file to /home/jla/stuff/file rather than to /home/jla/stuff/stuff/file.