Weekend Trip

上周末我和朋友一起去旅行。 周六我们去了巴斯, 周日布里斯托尔和滨海韦斯顿。

我们先逛镇中心再去吃重庆小面。我们去了帕雷德花园和普尔特尼桥。下午我们去了罗马浴场。

晚上我们去了Green Park Brasserie吃晚餐,这个饭馆有现场乐队演出。

周日我们去了布里斯托尔,看到了Banksy艺术和克利夫顿吊桥。然后去了滨海韦斯顿,走在沙滩上。

我们还看到了两条彩虹。

     

Meal in Glasgow

昨天我跟朋友在格拉斯哥吃了中餐,我们点餐了饺子和包子

饺子: 猪肉大白菜馅 – 锅贴 三鲜(猪肉,大虾, 韭菜) – 煮水饺

包子: 叉烧包

我还喝了珍珠奶茶

Yesterday me and my friend had Chinese food for lunch and dinner. At lunch we had 水煮鱼 and 麻辣豆腐 , I chose the 麻辣豆腐 as it’s the only thing I could understand on the Chinese menu 😂.

For dinner we had dumplings and baozi.

I also tried bubble tea for the first time yesterday, I had a green tea one.

Today I had a pearl milk tea.

     

Compiling OpenSSL 1.0.2d on 64-bit Cygwin

Out of the box I couldn’t get OpenSSL to compile on 64-bit Cygwin, below are the steps I used to successfully compile it.

  1. Use “tar xf openssl-1.0.2d.tar.gz” to decompress the source
  2. Add  options=”$options no-asm” to line 913 of config
  3. Run ./config
  4. Change -march=i486 to -march=x86-64
  5. Run make
  6. All done

Note that I had to use tar to decompress it as 7zip wreaked the symlinks used in there which caused some #includes to fail.

 

Stopping “No Disk” Error Pop-up In Windows

While working on a project that used the Microchip C18 compiler I got this error message:-

If I clicked “Continue” it would appear again instantly, and this kept going dozens of times, the compile worked fine but the error message was very annoying. The drive in question was a partition on my main hard disk, it was not a removable drive!

After a bit of research I found out how to suppress the error message by modifying the system registry. Below is an example of the .reg file I created.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows]
"ErrorMode"=dword:00000002

This will disable all application and system error pop-ups, which may not be what you want so what I did is create two reg files, on disables the errors, the other enables the errors. This means I can temporarily disable the errors when I want.

For more information on this see this Microsoft support page.

WARNING! Modifying your system registry could be dangerous, proceed with caution. I am not responsible for any damage you cause to your system!

I recommend creating a system restore point before making any modifications to the system registry.

   

Changing File Permissions in Cygwin (Windows 8)

I tried to change the permissions of my ssh private/public keys in the .ssh directory under Cygwin on Windows 8 and it didn’t work. This seems to be a bug in Cygwin but there is a work around that I found through SuperUser.

chgrp -R Users ~/.ssh

Now all you need to do is run the chmod commands as usual and all should work.

 chmod 644 id_rsa.pub
 chmod 600 id_rsa
     

Handling SIGUSR1 in GDB

I was debugging a project that used SIGUSR1 heavily, GDB stops on SIGUSR1 by default and it was making debugging a pain when I didn’t care when the signal was being generated. So here is now to set how GDB interprets signals.

By entering the following into the GDB prompt you can instruct it to not print, or stop when the signal happens and to pass it to the program.

handle SIGUSR1 nostop noprint pass

     

Extracting Audio From MP4 Videos

I’ve been asked to help someone create a device that can play steam train whistle sounds when a button is pressed. I was given a load of MP4 video files with recordings of the whistles.

First I wanted to rename them because they all had a “Prj ” prefix on them. The code snippet below is what I used to remove the prefix from the file names.

for file in *.mp4 ;
do
    mv "$file" $(echo "$file" | sed 's/Prj //')
done

The next thing to do is extract the audio from all the videos. FFMPEG is perfect for this. The Bash code below will extract the audio from all of the MP4 files in a directory.

for file in *.mp4 ;
do
    ffmpeg -i $file -map 0:1 -acodec pcm_s16le -ac 2 ${file/.mp4/.wav}
done

Now that I’ve got the audio files I need to open them in Audacity and edit them, that is something I can’t automate unfortunately 😢

         
1 2 3 4 5