Thunderbird and bad date format

Basically the date format in Thunderbird follows the system locale – in a terminal type ‘locale’ and the LANG entry should be something like en_GB – if it’s en_US, that’s why it’s displaying the date in the bizarre US format which is MM/DD/YYYY rather than DD/MM/YYYY

To rectify this problem:

1. locale -a
2. vim /etc/locale.gen
3. uncomment:
en_GB.UTF-8 UTF-8
4. comment out:
en_US.UTF-8 UTF-8
5. locale-gen
6. localedef --list-archive OR localectl list-locales
7. vim /etc/locale.conf
LANG=en_US.UTF-8

To make locale changes immediate:

8. unset LANG
9. source /etc/profile.d/locale.sh

Migrating to a larger SSD disk

I have upgraded to a larger SSD disk, I moved from 500GB to 1TB.

I think the best option is to connect 2 disks to the SATA3 connectors and use dd to clone the whole disk from a smaller to the larger one. This is the fastest way and it took only 17 minutes to clone 500GB with over 500MB/s transfer rates.

lsblk
dd if=/dev/old of=/dev/new bs=1M conv=noerror,sync status=progress

then use GParted to make any changes to partition layout.

This tool is very easy to use and does the job. After you remove partitions you don’t need and move things around you end up with a bunch of unallocated disk space you would like to merge with your existing home partition. In my case this partition is encrypted. I have resized this partition using GParted. After that you have to decrypt the partition to then be able to resize

cryptsetup luksOpen /dev/sdx homecrypt
cryptsetup resize homecrypt
e2fsck -f /dev/mapper/homecrypt
resize2fs -p /dev/mapper/homecrypt

If the partition layout has changed much you want to update fstab and Grub

Windows wants to format your external hard drive?

It looks like filesystem on your external hard drive is having some issues, but most often these issues are not impacting the whole disk partition but it’s to do with some individual files that may be corrupt.

Windows asking to format the hard drive is way too much.

Instead of following Windows please run the below command as administrator from Windows CLI:

chkdsk E: /f

where E: is the letter of the affected hard drive partition.

Windows 7 N and HTC phone

I was unable to connect my HTC phone to Windows 7, it was not detecting it properly.
It was showing it as “Android Phone” but after multiple attempts I had no success with driver installation, no access to photos. Installing HTC Sync Manager did not help either.
It turned out that Windows 7 N which is a separate Windows 7 release for European Union is lacking Media Pack which contains necessary bits and pieces.
You have to download Media Pack from Microsoft website, install then restart your system then all should work fine.

Disable touchscreen in Windows 7 and Linux

In Windows please disable one of the HID Devices in Device Manager, if this does not work try USB device listed in the same Device Manager HID container.

In Linux edit the “/usr/share/X11/xorg.conf.d/10-evdev.conf” file.
You edit the touchscreen section in 10-evdev.conf file is the last section.
It will have this identifier in the section – Identifier “evdev touchscreen catchall” – the identifier seems to be the 2nd line in all the sections.
Just add in this line – Option “Ignore” “on” as the last line before “End Section”

mount –bind vs symbolic link

With mount –bind, a directory tree exists in two (or more) places in the directory hierarchy. This can cause a number of problems. Backups and other file copies will pick all copies. It becomes difficult to specify that you want to copy a filesystem: you’ll end up copying the bind-mounted files twice. Searches with find, grep -r, locate, etc., will traverse all the copies, and so on.

You will not gain any “increased functionality and compatibility” with bind mounts. They look like any other directory, which most of the time is not desirable behaviour. For example, Samba exposes symbolic links as directories by default; there is nothing to gain with using a bind mount. On the other hand, bind mounts can be useful to expose directory hierarchies over NFS.

You won’t have any performance issues with bind mounts. What you’ll have is administration headaches. Bind mounts have their uses, such as making a directory tree accessible from a chroot, or exposing a directory hidden by a mount point (this is usually a transient use while a directory structure is being remodelled). Don’t use them if you don’t have a need.

Only root can manipulate bind mounts. They can’t be moved by ordinary means; they lock their location and the ancestor directories.

Generally speaking, if you pass a symbolic link to a command, the command acts on the link itself if it operates on files, and on the target of the link if it operates on file contents. This goes for directories too. This is usually the right thing. Some commands have options to treat symbolic links differently, for example ls -L, cp -d, rsync -l. Whatever you’re trying to do, it’s far more likely that symlinks are the right tool, than bind mounts being the right tool.

it’s worth noting that some utilities might consider a bind-mounted directory to be a separate file system. This may have performance or functionality implications if the program can no longer assume that the same inode number refers to the same file (which it doesn’t, if they are on different file systems), a move cannot be optimized as link-at-target-then-unlink-source, etc.

Author: Gilles

Time zones

Dirty script to show times in different places in the world

echo -n -e "World Times:\n\tTokyo\t\t"; TZ=":Asia/Tokyo" date | cut -d " " -f4; echo -n -e "\tShanghai\t"; TZ=":Asia/Shanghai" date | cut -d" " -f4;echo -n -e "\tMoscow\t\t"; TZ=":Europe/Moscow" date | cut -d" " -f4;echo -n -e "\tRome\t\t"; TZ=":Europe/Rome" date | cut -d" " -f4;echo -n -e "\tLondon\t\t"; TZ=":Europe/London" date | cut -d" " -f4;echo -n -e "\tNew York\t"; TZ=":America/New_York" date | cut -d" " -f4;echo -n -e "\tLos Angeles\t"; TZ=":America/Los_Angeles" date | cut -d" " -f4

find your preferred places in /usr/share/zoneinfo
then place the script in your .bashrc

Swap

Quick way to setup swap

fallocate -l 4G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
mkswap /swapfile
swapon /swapfile
free -m

vim /etc/fstab
At the bottom of the file, you need to add a line that will tell the operating system to automatically use the file you created:
/swapfile none swap sw 0 0

Windows 7: regaining disk space

net stop wuauserv
ren %systemroot%\SoftwareDistribution SoftwareDistribution.old
net start wuauserv
rd /s/q %systemroot%\SoftwareDistribution.old

DISM.exe /online /Cleanup-Image /spsuperseded

bear in mind that above command is super-case-sensitive
sfc /scannow

Unfortunately in Windows 7 you cannot get rid off update packages in WINSXS folder (this can reach 12GB). You can clear it up in Windows 8.1 and later.

Security clearance in UK

Types of national security clearance

There are four main types of Security Clearance – Baseline, Counter Terrorist, Security Check and Developed Vetting. Below is an outline of each type of Security Clearance, along with information on the process, how long it takes, and the types of IT jobs it applies to.

The important thing to remember is that Security Clearance checks are conducted in line with a specific IT job role, and need to be requested by a company not an individual. So while Security Clearance may require some time and paperwork, if successful it will lead to a new IT job – as well as career rewards such as a good salary, role security and plenty of opportunity.

Baseline Security Clearance

There are two types of check in this category: Baseline Personnel Security Standard (BPSS) (Formally Basic Check) and Enhanced Baseline Standard (EBS) (formerly Enhanced Basic Check or Basic Check +). A BPSS or EBS aims to provide an appropriate level of assurance as to the trustworthiness, integrity, and probable reliability of prospective employees.

What is BPSS?
BPSS is an entry level security check, and will take one or two days to complete. Not technically a security clearance, it uses the Police National Computer (PNC) to make sure a candidate has no convictions. The check returns evidence of any current criminal record and un-spent convictions under the Rehabilitation of Offenders Act 1974.

A BPSS acts as a pre-employment check, signaling good recruitment and employment practice in general. The check is carried out by screening identity documents and references. Continue reading Security clearance in UK

VirtualBox and networking between guests

For this to happen you have to enable a secondary network adapter that is set as Internal Network (make sure you assign both guests to the same Internal Network, default is “intnet”)
The next step is to enable DHCP server on that network by this command:
VBoxManage dhcpserver add –netname intnet –ip 10.0.0.100 –netmask 255.255.255.0 –lowerip 10.0.0.101 –upperip 10.0.0.150 –enable

CyanogenMod for Sony device

1. To get to the service menu type this code in your dialer:
*#*#7378423#*#*
This way you can check if you can unlock your bootloader, it is 50/50 chance, it depends on the production batch.
If a bootloader is allowed to be unlocked you can install custom ROM, if not you will not be able to proceed any step further
2. find the right device on CM website http://get.cm/
3. download the right build image (stable or nightly) and corresponding recovery image
4. download Open Google Apps from here http://opengapps.org/?api=5.0&variant=nano
As you can see I would go for NANO build which is below 100MB in size
5. unlock bootloader: http://developer.sonymobile.com/unlockbootloader/
6. PLEASE NOTE: you will need ADB and FASTBOOT applications and correct Sony drivers to be able to flash recovery image once the bootloader is unlocked
PLEASE NOTE that ADB and FASTBOOT uses different drivers to access the device
device is accessible using ADB when it is in normal mode
adb devices
device is accessible using FASTBOOT only from recovery mode
fastboot devices
fastboot flash boot boot.img
fastboot reboot

7. follow the instructions from an email they are going to send you
adb reboot bootloader - this is effective way to get to recovery mode for fastboot
fastboot -i 0x0xxx oem unlock 0xDxxxxxxxxxxxxx

8. flash custom ROM
adb sideload cm-12.1-date-STABLE-devicecodename.zip (from this moment you will not be able to access service menu anymore as it is not included in custom ROM)
9. install Google Apps
adb sideload open_gapps-arm-5.1-nano-2016xxxx.zip
10. go trough initial device setup, sign up to Google Play
11. enable Root access within Developers option -> Root access for Apps and ADB
12. install TWRP ROM manager
13. flash TWRP recovery image
You definitely want to read this: https://twrp.me/devices/sonyxperiaz3tabetcompact.html as you will be presented with a question that your have to check prior flashing recovery image, you risk bricking the device so double check.
14. once custom TWRP image is flashed you can boot to it and perform a first backup

whatever you do or fix please test it afterwards, better however do not fix things that work, wait until they break otherwise feel the wrath of dummy users.