Git pull stopped working

So this is a weird one. I’d previously grabbed some code from a git repository. But recently when I went to update it, I got an error

fatal: unable to connect to github.com:
github.com[0: 140.82.118.4]: errno=Connection refused
github.com[1: 140.82.118.3]: errno=Connection refused

Uh-oh. Thinking it might be a transient error, I left it for a while. But then when I got the report from my firewall logs, I saw some outbound connection attempts which it was blocking.

 Nov 15 12:20:42 DST=140.82.118.4 PROTO=TCP DPT=9418
 Nov 15 12:20:43 DST=140.82.118.4 PROTO=TCP DPT=9418
 Nov 15 12:20:43 DST=140.82.118.3 PROTO=TCP DPT=9418

So googling around I saw that this port was related to a proprietary git protocol, and then I connected the two events. So apparently the last time I checked out the code, it had used the default git protocol. Then I installed a firewall with egress filtering on the server, so now it was blocking the connection attempts. One solution would be to add tcp/9418 to my firewall rules, but there was actually a simpler way. From the code directory I edited the .git/config file and changed the url= line:

[remote "origin"]
        url = https://github.com/repo/repo.git
        # url = git://github.com/repo/repo.git

And now my git pull works again. 

Gimp 2.8 Resynthesizer Plugin Ubuntu 18.

Seems like this plugin changes the rules ever so often. This is what worked for me today. 

Remove old plugins from ~/.gimp2.8/plug-ins/

Get the latest code from https://github.com/bootchk/resynthesizer.git

git clone https://github.com/bootchk/resynthesizer.git

Install dependencies and compile code. ./configure doesn’t work as suggested, so I just ran the .autogen script, which did. 

sudo apt install libglib2.0-dev libgimp2.0-dev automake intltool
./autogen.sh 
make
sudo make install
# plugins went into here
ls /usr/lib/gimp/2.0/plug-ins

Now when you start up gimp, you can see the Filters > Map > Resynthesize menu item, but I didn’t have the all-important Enhance > Heal Selection entry. That was got by installing another gimp package. 

apt install gimp-plugin-registry   # works on Ubuntu 18.04
apt install gimp-python    # apparently works on 18.10 (with gimp 2.10)



One Line Guitar Tuner

Every now and then I come across something which makes me marvel at the flexibility of Linux. This is one of these things.

I play guitar, and I’d previously written a small script to act as a guitar tuner. I generated some .ogg files of the correct pitch and then wrote a script to loop through them in sequence. “Pretty good”, I thought, “Clever Me.”

Then a few days ago I came across this little gem of a script.

for n in E2 A2 D3 G3 B3 E4;do play -n synth 4 pluck $n repeat 2;done

That’s it. Sheer brilliance. Of course you’ll need to install the sox package first.

Counting files in subdirectories.

ze countOK, it sounds simple, and it probably is if you’re sitting at your desktop with Gnome or KDE fired up. However if you’re looking on a server half way across the world, using the command line its not so easy.

There are a number of tools which are useful in finding out things about your filesystem. ls, du, df are three of them, but sometimes they just don’t give you the information you need. In my case I’m backing up a server to a remote location. The script was timing out becase I was trying to back up too many files at once, so I needed to find the number of files in each subdirectory.

Read moreCounting files in subdirectories.

Linux Memory Usage Summary Script

I was having trouble with a webserver this week, which I’d just set up for a client. When it went live, it seemed OK initially, but when we left it overnight it curled up its toes and died. It was so dead that I couldn’t even ssh in to reboot it, so we had to do a remote reboot. Crunch.

Anyway, on getting it back up, I poked around in the logs and found that it was running out of memory, which it really shouldn’t do given that it was a fairly low load on the webserver, and only apache, mysql and php were running on it. I looked around the Interwebs and found an excellent resource called Troubleshooting Memory Usage, which gave me some pointers about how to rein in apache and stop it from eating up memory so quickly. Thanks!

Anyway on the page was a script for summarising memory usage, which I thought was a good idea, so i grabbed that one and adapted it to my own purposes. I thought I’d make the results available here, so feel free to grab it and adapt it to your own needs.

Read moreLinux Memory Usage Summary Script