How to remove old Linux kernel images from /boot

For RedHat based OS

e.g RHEL or CentOS

Install yum-utils

yum -y install yum-utils

Check current running kernel version

rpm -q kernel

Remove old kernels, but leave the 2 latest ones.

package-cleanup --oldkernels --count=2

Edit /etc/yum.conf and set:

installonly_limit=2

This will delete old kernels automatically but leave the latest two next time you perform a yum update

For Debian based OS

e.g Ubuntu

apt-get -f autoremove
update-grub

If that doesn’t work, you may need to manually remove files from /boot using rm. Then run update-grub after.

You can always check what kernel is currently loaded by running uname -a

Generate some easy to remember passwords

Do not use this for sending sensitive data! For that please use a public key encryption scheme like PGP or GnuPG. This below is suitable for things such as online logins etc.

Obtain word list

Prepare a text file with dictionary words. Here we download some word lists from Scowl.

wget "http://downloads.sourceforge.net/wordlist/scowl-2016.01.19.tar.gz" && \
tar -zxvf scowl-2016.01.19.tar.gz --wildcards --strip-components=2 scowl-2016.01.19/final/english-words.*

We grab the file english-words.10 and english-words.20 which contain a lot of popular words, filter it and remove the words we don’t want. There are other files here too which you can use as well, though they may contain less commonly used words which may be more difficult to remember.

To make a word list from english-words.10 and english-words.20 with 5 chars or more

cat english-words.10 english-words.20 | grep -v "'" | grep -e "....." | uniq | xz -9 -e > words.txt.xz

On Mac OSX, you’ll need to set LANG=C otherwise you’ll get a charset error with uniq.

Count the number of words in the list. For my current test, there is 9481 words.

xz -dc words.txt.xz | wc -l

Generate a 4 word password

Let’s random sort and create a password with 4 words. We’ll capitalise the first letter as well.

On Mac OSX, install coreutils and gnu-sed on Homebrew.

Linux

xz -dc words.txt.xz | sort -R | head -n 4 | sed 's/^\(.\)/\U\1/' | tr -d '\n'

Mac

xz -dc words.txt.xz | gsort -R | head -n 4 | gsed 's/^\(.\)/\U\1/' | tr -d '\n'

Make 10 random 4 word passwords

The above command repeated 10 times.

Linux

for i in {0..9}; do xz -dc words.txt.xz | sort -R | head -n 4 | sed 's/^\(.\)/\U\1/' | tr -d '\n'; echo ""; done

Generate 10 random 3 word passwords

Make 10 random 3 word passwords

Linux

for i in {0..9}; do xz -dc words.txt.xz | sort -R | head -n 3 | sed 's/^\(.\)/\U\1/' | tr -d '\n'; echo ""; done

Mac

for i in {0..9}; do xz -dc words.txt.xz | gsort -R | head -n 3 | gsed 's/^\(.\)/\U\1/' | tr -d '\n'; echo ""; done

How to open Gerber files in AutoCAD with free open source tools

Here is a method for how you can import a Gerber RS-274X file into AutoCAD. There are many commercial software solutions to perform this, but this is how you can do it for free using open source tools!

You’ll need to install and configure (if needed) the following software.

  • gerbv – this is used to view Gerber files, and can also export to a variety of formats (but not DXF or DWG for AutoCAD)
  • pstoedit – converts Postscript files to many different other formats
  • ghostscript – needed by pstoedit

Open your Gerber files in gerbv. This process work for multiple layers as well. You should see your Gerber to make sure it is what it should be.

Export the Gerber set to PostScript. File -> Export -> Postscript…

Optionally, if you don’t need to visually check the Gerber file in gerbv, gerbv supports exporting via the command line, for example:

gerbv -x ps MYGERBER.GTL

Now convert the Postscript (.ps) file to DXF using pstoedit. This is best done on the command line.

pstoedit -f dxf foobar.ps foobar.dxf

Now you should have a .dxf file which you can open in AutoCAD.

Caveats

When working with multiple Gerber files and you export them all at once to one .ps file, and convert them to a single .dxf, all the information comes up in AutoCAD as a single layer, but the original layers can be differentiated by their colours.

However you could manually move different colours to new layers if need be (using QSELECT command in AutoCAD). This probably could be scripted, but that’s a bit beyond my means at the moment.

GLCD Library Support for PIC24H with ST7565R / ST7565P / PCD8544 (Nokia 3310 5510) LCDs

My graphic LCD library (glcd on GitHub) now supports PIC24H with the ST7565R, ST7565P and PCD8544 LCD controllers.

The code has been tested with the Newhaven display NHD-C12864A1Z-FSW-FBW-HTT and NHD-C12832A1Z-FSW-FBW-3V3. I used a Microstick II development board to test these, with demo code available below. I don’t have any PIC24F chips so I wasn’t able to test it with those chips as well (I think I have lost the chip from the Microstick II package). I would think only minor changes would be needed to make it work with PIC24F.

Sample code

Sample code for use with MPLAB X IDE.

Here are some sample projects:

Note that the glcd libraries included with the demos above are not kept up to date as further updates are made to the official glcd library. You can update the library by copying the latest glcd distribution into the existing project files. (take note of custom pin configurations, more details below)

Pin configuration

With the projects above, the pin connections to the LCD’s SPI interface are as follows:

  • SDA (serial data input) => RB14
  • SCK (serial clock) => RB15
  • SS / CS (chip select) => RB2
  • A0 (command / data write selection) => RB3
  • RESET => RA2

To add your own custom pin configuration, you can edit the file ‘devices/PIC24H.h’. You can also make a custom configuration file by creating a `glcd_user_config.h’ file outside of the glcd directory and defining a new compiler symbol ‘GLCD_USER_CONFIG’. Copy the contents of ‘PIC24H.h’ into it. This way, if you need to  update the library, you can simply overwrite the contents of the existing glcd directory without losing your custom pin configuration. Otherwise, you can just keep track yourself of custom changes made to the *.h files in the ‘devices/’ directory.

Videos

Footage of Newhaven Display NHD-C12864A1Z-FSW-FBW-HTT in action, running the sample code:

Footage of Newhaven Display NHD-C12832A1Z-FSW-FBW-3V3 in action, running the sample code: