Developers notebook

UNIX timestamp and Active Directory timestamp for given date and time

/** Returns UNIX timestamp and Active Directory timestamp for given date and time */


//Format dd-mm-yyyy
$dateFromForm = '24-05-2020';

//Format hh:mm:ss
$timeFromForm = "00:00:00";

$CLI = 1;
if ($CLI = 0) { $LF = "<br>";} else {$LF = "\r\n";}
$dateWithTime = $dateFromForm." ".$timeFromForm;

function convertDateToUnix($input) {
$format = 'd-m-Y H:i:s';
$date = DateTime::createFromFormat($format, $input);
$UNIXTimestamp = $date->getTimestamp();
return $UNIXTimestamp;

function convertUnixtoWin($input) {
return ($input+11644473600)*10000000;

echo "*** Welcome to the Timestamp converter ***".$LF;
echo $LF."You entered: ".$dateWithTime.$LF;
echo $LF."UNIX Timestamp is ".$UNIX.$LF;
echo $LF."Windows Timestamp is ".convertUnixtoWin($UNIX).$LF;
echo $LF."**************************************".$LF;

Amazon ec2 CLI – Return instance public DNS by tag

aws ec2 describe-instances –output=json –filter Name=tag:{TAG NAME},Values=”{TAG VALUE}” –query “Reservations[].Instances[].PublicDnsName”

For example if you have some ec2 instances with a tag key “Name” and the value “Webserver Auto Scaling Group”

aws ec2 describe-instances –output=json –filter Name=tag:Name,Values=”Webserver Auto Scaling Group” –query “Reservations[].Instances[].PublicDnsName”

Find and replace a line with sed

sed -i “/;Thing to find/c\Thing to replace it with” /path/to/file

sed -i “/;date.timezone =/c\date.timezone = Europe/London” /etc/php.ini

Load data in to Maria DB from csv file

Place your import data file inside the database data directory e.g /var/lib/mysql/{database name}

Give the mysql user permission.  chown mysql:mysql {data.csv}

mysql -uroot -p –local-infile=1 {database name}

Load the data:

LOAD DATA INFILE ‘{data.csv}’
INTO TABLE  {table name}

If your data has a field headings row, this can be omitted from the import with.

NTLM error on openSUSE 13.2

When setting up NTLM on openSUSE I was getting a 500 server error from Apache.

In the error log: ntlm_auth reports Broken Helper: BH NT_STATUS_ACCESS_DENIED NT_STATUS_ACCESS_DENIED

Solved with setfacl -m u:wwwrun:rx /var/lib/samba/winbindd_privileged

Windows Update error 80244022

My PC wasn’t getting it’s updates from our on site Windows update server.  Follow these steps to get the updates directly from Microsoft.  This worked for me on Windows 8, should be good for Windows 7 too.

1. Open registry editor (Start menu –> Run –> regedit)

2. Find the following path HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU

3. Change the value of the UseWUServer from 1 to 0 (double click on it, change the value and click OK)

4. Restart Windows Update service (Start menu –> Run –> services.msc –> find the Windows Update service and click on Restart)

You may find group policy sets it back next time they are applied

Orignal source

Flush DNS cache on OS X Yosemite

sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder

Run command after boot SuSE

Append a command to the end of file /etc/init.d/boot.local to be executed after booting.

echo “command” >> /etc/init.d/boot.local

Example: echo "/opt/zend/bin/ start" >> /etc/init.d/boot.local

Original source:

Favicon Swiss army knife

If you need to set the Favicon for a website this is the place to go 

Musical evolution

First iteration 1983: Conquering Lion – Jah Shaka

Second iteration 1992: Liquid Is Liquid – Liquid

Third iteration 1997: Serious Danger – Deeper


« Older posts

© 2016

Theme by Anders NorenUp ↑