Can’t Clean a Full /boot Because of Unmet Dependencies

Use the dpkg tool to force the removal of some kernel packages. This is not suggested for common use and is a bit dangerous, but in such case with unmet dependencies might help. First of all, locate the kernel in which the system is booted. The one that is currently loaded. Open a terminal (CTRL+ALT+T)… Read More »

ROT13 Encoder Source Code

The ROT13 encoder is a fun programming exercise that my students enjoyed recently. I have included my source code here in PHP and C. PHP <?php   function rot13($char)   {     $ascii = ord($char);     if (($ascii >= 65) && ($ascii <= 90))     {       $val = ($ascii – 51) % 26;       if ($val == 0)       {         $val = 26;       }       $val += 64;     }     else if (($ascii >= 97) && ($ascii <= 122))      {       $val = ($ascii – 83) % 26;       if ($val == 0)       {         $val = 26;       }       $val += 96;     }     else     {       $val = $ascii;     }     return (chr($val));   }   function main()   {… Read More »

Easy WordPress Install Recipe

Installing your own WordPress server is extremely easy but there seems to be a lot of articles that needlessly complicate it. Starting with a base install of Ubuntu Server (Amazon AWS is a good free choice for this), SSH into your server and run the commands below: Change to Root $ sudo -i If Your… Read More »

Sanitising User Form Input Before Processing in PHP

Sanitising user form input before processing the data is an IMPORTANT security step to prevent malicious input wreaking havoc on your program or other unsuspecting users. The function below can take the $_POST array as input and return it sanitised for use. function cleanse($input) { // Clean the input before use to make sure we don’t… Read More »

PHP :: Determine the A, B or C Class Network of an IP Address

I use the code below to determine the A, B or C class of an IP address. This was helpful for identifying a student on our internal network so that they access the Intranet without needing to log in. <?php function ipClass($ip) { try { $array = explode(“.”, $ip); $a = $array[0] . “.0.0.0”; $b… Read More »

Terminal Emulator on Mac OS X

My favourite terminal program on Windows was PuTTY but unfortunately there’s no free equivalent on OS X. There’s iTerm 2, but because I need console access (serial) to configure Cisco routers, it won’t do what I need. I considered Zoc but at $80 I couldn’t justify it even though my awesome boss would reimburse me… Read More »

Mass Renaming of Files on OS X or Linux

If you have a large number of files that you nee to rename, it can be a real pain trying to do it in the GUI or on the CLI. The following script can be used to replace any character or string of characters in the name of every file in a directory. #!/bin/bash ls… Read More »

Squid Proxy to Block Consumer Gmail and Force YouTube for Schools

The purpose of this document is to provide a cookbook approach to building a Squid proxy that can: Intercept HTTPS/SSL packets; Inject the HTTP headers X-GoogApps-Allowed-Domains; X-YouTube-Edu-Filter; Rewrite URLs for Youtube to add the edufilter option. The base operating system for this deployment is Ubuntu Server 12.04 LTS. You can accept all of the defaults… Read More »