Category Archives: Programming

2N® SIP Speaker Auto Provisioning

We’re rolling out a new public address system at work and have opted to install it ourselves because the cost of outsourcing it would have blown our budget. The upside was this enabled us to go for a full IP based system with the savings and still be well under budget. The system we selected… Read More »

Reset User Passwords and Add Missing Users to Active Directory via PowerShell from Google Accounts

MySQL SQL Code SELECT SUBSTRING_INDEX(Google.primaryEmail , ‘@’ , 1) AS ‘SamAccountName’ , Google.name.givenName AS ‘GivenName’ , Google.name.familyName AS ‘Surname’ , Google.name.fullName AS ‘DisplayName’ , CASE CONVERT(SUBSTRING_INDEX(SUBSTRING_INDEX(Google.orgUnitPath , ‘/’ , – 1), ‘ ‘, -1),UNSIGNED INTEGER) WHEN 6 THEN “OU=7,OU=Middle,OU=Students,OU=Users,OU=Thornlie Accounts,DC=tcc,DC=wa,DC=edu,DC=au” WHEN 7 THEN “OU=8,OU=Middle,OU=Students,OU=Users,OU=Thornlie Accounts,DC=tcc,DC=wa,DC=edu,DC=au” WHEN 8 THEN “OU=9,OU=Middle,OU=Students,OU=Users,OU=Thornlie Accounts,DC=tcc,DC=wa,DC=edu,DC=au” WHEN 9 THEN “OU=10,OU=Senior,OU=Students,OU=Users,OU=Thornlie Accounts,DC=tcc,DC=wa,DC=edu,DC=au”… Read More »

Delete Blank Pages from a PDF on Linux Command Line

OK, so I was looking for  a way to delete perceptually blank pages from PDF files in bulk. I found scripts that will remove truly blank pages, but that doesn’t help with pages that have been scanned because they can have just 1 pixel and now they’re not blank. The script below which is running… 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 »