Friday, March 16, 2018

systemd-udevd taking 100 percent cpu - solved by blacklisting cx88_alsa audio driver and cx88xx etc TV Card Driver

--------------------------------------------------
Problem
--------------------------------------------------
systemd-udevd taking 100% cpu.
Even failing to power off Ubuntu. (screen shut down, machine power stayed on. Has to long press power button to shuf down Ubuntu1604LTS.)

--------------------------------------------------
Investigating
--------------------------------------------------
Seeing this i2c related kernel error.
"i2c i2c-1: sendbytes: NAK bailout."
It's reported previously. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1675540
This bug still exists and looks like it was identified as part of the Nouveau video driver, experienced now with Ubuntu 16.10.


$dmesg indicated that it's when calling cx88_audio_pci_driver_init
  continuously time out due to i2c error.
      - pci_audio_driver loading hang.....
        [   15.080129] i2c i2c-13: sendbytes: error -110
        [   16.287687] ip_tables: (C) 2000-2006 Netfilter Core Team
        [   16.308070] ip6_tables: (C) 2000-2006 Netfilter Core Team
        [  244.171444] INFO: task systemd-udevd:325 blocked for more than 120 seconds.
        [  244.171451]       Not tainted 4.13.0-32-generic #35~16.04.1-Ubuntu
        [  244.171453] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [  244.171456] systemd-udevd   D    0   325    278 0x00000004
        [  244.171460] Call Trace:
        [  244.171470]  __schedule+0x3c2/0x890
        [  244.171474]  schedule+0x36/0x80
        [  244.171477]  schedule_preempt_disabled+0xe/0x10
        [  244.171480]  __mutex_lock.isra.2+0x2ae/0x4e0
        [  244.171487]  ? driver_probe_device+0x450/0x450
        [  244.171490]  __mutex_lock_slowpath+0x13/0x20
        [  244.171492]  ? __mutex_lock_slowpath+0x13/0x20
        [  244.171495]  mutex_lock+0x2f/0x40
        [  244.171497]  __driver_attach+0x5d/0xf0
        [  244.171500]  ? driver_probe_device+0x450/0x450
        [  244.171503]  bus_for_each_dev+0x6c/0xc0
        [  244.171506]  driver_attach+0x1e/0x20
        [  244.171508]  bus_add_driver+0x1f4/0x270
        [  244.171512]  ? 0xffffffffc00a6000
        [  244.171515]  driver_register+0x60/0xe0
        [  244.171517]  ? 0xffffffffc00a6000
        [  244.171522]  __pci_register_driver+0x4c/0x50
        [  244.171528]  cx88_audio_pci_driver_init+0x1e/0x1000 [cx88_alsa]       ..............
        [  244.171532]  do_one_initcall+0x53/0x1b0
        [  244.171536]  ? __vunmap+0x81/0xb0
        [  244.171540]  ? kmem_cache_alloc_trace+0x152/0x1b0
        [  244.171543]  ? kfree+0x162/0x170
        [  244.171548]  do_init_module+0x5f/0x209
        [  244.171551]  load_module+0x1961/0x1d60
        [  244.171556]  ? ima_post_read_file+0x7d/0xa0
        [  244.171561]  SYSC_finit_module+0xe5/0x120
        [  244.171564]  ? SYSC_finit_module+0xe5/0x120
        [  244.171568]  SyS_finit_module+0xe/0x10
        [  244.171572]  entry_SYSCALL_64_fastpath+0x33/0xa3
        [  244.171575] RIP: 0033:0x7ff05dcda4d9
        [  244.171576] RSP: 002b:00007ffe319d70c8 EFLAGS: 00000202 ORIG_RAX: 0000000000000139
        [  244.171579] RAX: ffffffffffffffda RBX: 00005627dc1ac890 RCX: 00007ff05dcda4d9
        [  244.171581] RDX: 0000000000000000 RSI: 00005627dc1b8450 RDI: 0000000000000007
        [  244.171583] RBP: 00005627dc1b8450 R08: 0000000000000000 R09: 0000000000000011
        [  244.171584] R10: 0000000000000007 R11: 0000000000000202 R12: 0000000000000000
        [  244.171586] R13: 00005627dc1cec00 R14: 0000000000020000 R15: 0000000000000000

Tried loading old kernel back to 4-Feb. Problem still exist.
        qyang@Ubuntu1604LTS:~$ ll /lib/modules/
        total 24K
        drwxr-xr-x  5 root root 4.0K Jun 20  2017 4.8.0-56-generic/
        drwxr-xr-x 23 root root 4.0K Feb  4 07:36 ../
        drwxr-xr-x  5 root root 4.0K Feb  4 07:40 4.13.0-32-generic/
        drwxr-xr-x  5 root root 4.0K Feb 25 09:50 4.13.0-36-generic/
        drwxr-xr-x  6 root root 4.0K Mar 15 22:19 ./
        drwxr-xr-x  5 root root 4.0K Mar 15 22:48 4.13.0-37-generic/

Check cx88 releated hardware drivers.
        qyang@Ubuntu1604LTS:~$ lsmod |grep cx88
        cx88_alsa              20480  1
        snd_pcm                98304  5 snd_hda_intel,snd_hda_codec,cx88_alsa,snd_hda_core,snd_hda_codec_hdmi
        cx8800                 40960  1
        cx8802                 20480  0
        cx88xx                 90112  3 cx88_alsa,cx8802,cx8800
        videobuf2_dma_sg       16384  1 cx8800
        tveeprom               24576  1 cx88xx
        v4l2_common            16384  3 tuner,cx88xx,cx8800
        videobuf2_v4l2         24576  1 cx8800
        videobuf2_core         40960  4 cx8802,cx88xx,videobuf2_v4l2,cx8800
        videodev              172032  7 tuner,v4l2_common,cx88_alsa,videobuf2_core,cx88xx,videobuf2_v4l2,cx8800
        snd                    81920  22 snd_hda_intel,snd_hwdep,snd_seq,snd_hda_codec,cx88_alsa,snd_timer,snd_rawmidi,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_seq_device,snd_hda_codec_realtek,snd_pcm
        rc_core                36864  4 rc_winfast,ite_cir,cx88xx
        i2c_algo_bit           16384  2 cx88xx,nouveau


--------------------------------------------------
Fix Applied
Ref:
    https://unix.stackexchange.com/questions/28240/disable-detection-of-certain-hardware
--------------------------------------------------
Decided to disable driver load.

      - $touch /etc/modprobe.d/blacklist-cx88-alsa.conf and edit it.
        qyang@Ubuntu1604LTS:~$ cat /etc/modprobe.d/blacklist-cx88_alsa.conf
        blacklist cx88_alsa
        blacklist cx88xx
        blacklist cx8800
        blacklist cx8802
      - Problem solved after reboot.

Saturday, February 24, 2018

installed vlc 2.1.3 via iFunbox for iPad1



ipa file of vlc can be downloaded from http://downloads.videolan.org/videolan/vlc-iOS/2.1.3/

iFunbox can be downloaded from http://www.i-funbox.com/en_download.html


You need to install AppLinks via Cydia in order to see those folders to upload video file directly.

Tuesday, January 2, 2018

Passport photo editing


----

au passport     3.75 x 4.75 cm  3.5-4.0 x 4.5 - 5.0cm
head                3.4 cm(3.2 - 3.6)

----
chinese passport 
head 28-33mm length 21mm-24mm width
2x2 inches

----

original photo:

head 73.75cm
resolution: 28.346  pixels/cm

28.346*73.75/3.4 = 614.858 pixels/cm

head 69.74
resolution: 28.346 pixels/cm
28.346*69.74/3.4 = 581.426 pixesl/cm

----

New Element size:
614.858 pixels/cm      3.75 x 4.75 cm

New Element size:
581.426 pixels/cm      3.75 x 4.75 cm


----

AU Passport 6 elemetes size:
581.426 pixels/cm      4 x 6 inches



Friday, November 24, 2017

Change default boot OS in Ubuntu Grub from Linux to Window


Ref: http://www.linuxandubuntu.com/home/how-to-change-boot-order-set-default-boot-os-in-ubuntu-14-10-15-04-linux-mint-or-other-derivatives

Brief of command line:
1. Find out the entry ID list.
qyang@lubuntu-laptop:~$ grep menuentry /boot/grub/grub.cfg
2. Change the default boot id.
qyang@lubuntu-laptop:~$ sudo vi /etc/default/grub
3. Upgrade grub.cfg via 'update-grub'.
qyang@lubuntu-laptop:~$ sudo update-grub

Details in command line:

qyang@lubuntu-laptop:~$ grep menuentry /boot/grub/grub.cfg
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
  menuentry_id_option=""
export menuentry_id_option
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-73-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-73-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-73-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-73-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-69-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-69-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-69-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-69-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-56-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-56-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-56-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-56-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-51-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-51-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-51-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-51-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-37-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-37-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-37-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-37-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-33-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-33-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-33-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-33-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-32-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-32-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-32-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-32-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-31-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-31-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-31-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-31-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-30-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-30-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-30-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-30-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Memory test (memtest86+)' {
menuentry 'Memory test (memtest86+, serial console 115200)' {
menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-7E980FF3980FA8AB' {
menuentry 'Windows 7 (loader) (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-chain-48D0359CD0359164' {
menuentry 'Windows Recovery Environment (loader) (on /dev/sda3)' --class windows --class os $menuentry_id_option 'osprober-chain-4A765B93765B7F1F' {




qyang@lubuntu-laptop:~$ sudo update-grub
[sudo] password for qyang:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.19.0-73-generic
Found initrd image: /boot/initrd.img-3.19.0-73-generic
Found linux image: /boot/vmlinuz-3.19.0-69-generic
Found initrd image: /boot/initrd.img-3.19.0-69-generic
Found linux image: /boot/vmlinuz-3.19.0-56-generic
Found initrd image: /boot/initrd.img-3.19.0-56-generic
Found linux image: /boot/vmlinuz-3.19.0-51-generic
Found initrd image: /boot/initrd.img-3.19.0-51-generic
Found linux image: /boot/vmlinuz-3.19.0-37-generic
Found initrd image: /boot/initrd.img-3.19.0-37-generic
Found linux image: /boot/vmlinuz-3.19.0-33-generic
Found initrd image: /boot/initrd.img-3.19.0-33-generic
Found linux image: /boot/vmlinuz-3.19.0-32-generic
Found initrd image: /boot/initrd.img-3.19.0-32-generic
Found linux image: /boot/vmlinuz-3.19.0-31-generic
Found initrd image: /boot/initrd.img-3.19.0-31-generic
Found linux image: /boot/vmlinuz-3.19.0-30-generic
Found initrd image: /boot/initrd.img-3.19.0-30-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
Found Windows 7 (loader) on /dev/sda2
Found Windows Recovery Environment (loader) on /dev/sda4
done




qyang@lubuntu-laptop:~$ sudo fdisk -l
[sudo] password for qyang:

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1cb42612

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048   3074047   3072000   1.5G 27 Hidden NTFS WinRE
/dev/sda2         3074048 207874047 204800000  97.7G  7 HPFS/NTFS/exFAT
/dev/sda3       207874048 952238079 744364032   355G  5 Extended
/dev/sda4       952238080 976773119  24535040  11.7G 17 Hidden HPFS/NTFS
/dev/sda5       207876096 576516095 368640000 175.8G  7 HPFS/NTFS/exFAT
/dev/sda6       584908800 952238079 367329280 175.2G 83 Linux
/dev/sda7       576518144 584906751   8388608     4G 82 Linux swap / Solaris

Partition table entries are not in disk order.

Friday, August 11, 2017

Batch renaming multiple files in Linux


[1] https://stackoverflow.com/questions/208181/how-to-rename-with-prefix-suffix

using 'rename'
rename 's/(.*)$/new.$1/' original.filename
shell script
for filename in *.jpg; do mv "$filename" "prefix_$filename"; done;
brace expansion
mv {,new.}original.filename


Convert multiple image files into one pdf file using Linux command line.

[1] https://www.imagemagick.org/script/index.php


Convert multiple images into one pdf file under Linux command line.

#apt-get install imagemagick
$convert file1.jpg file2.jpg merge.pdf

Tuesday, June 6, 2017

Set JAVA_HOME in Ubuntu


Ref from 'askubuntu.com'


Three files you could edit, '/etc/environment' is the one prefered in web post:
/etc/environment
/etc/profile
~/.bashrc

But I chose adding file: /etc/profile.d/dnm-build-envsetting.sh

- Reboot pc, and all environments variables settings remains.
        qyang@lgm-pc:~$ cat /etc/environment
        PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
        qyang@lgm-pc:~$ cat /etc/profile.d/dnm-build-envsetting.sh
        # Some environmental variables required for DmM builder to work for android build.
        # 2017-JUN-09
        JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
        ANDROID_HOME=/home/qyang/sandbox/android-sdk-linux
        QTDIR=/home/qyang/sandbox/qt-everywhere-opensource-4.8.7
        export JAVA_HOME
        export ANDROID_HOME
        export QTDIR


My old settings:
yang@lgm-pc:~/testsetupscript$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
qyang@lgm-pc:~/testsetupscript$ cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$PS1" ]; then
  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

# The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

JAVA_HOME=/usr/local/java/jdk1.8.0_25
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH

Wednesday, March 29, 2017

iPad 1 Sync files via SSH



Ipad 1 Sync files via SSH

​set up ssh server on ipad Launch Cydia and search for and install OpenSSH.
When asked for a password, use alpine, which is the default password for all iOS devices
​enable display mirror utube Install 'display mirror' but has to be launched from ssh console.​recommend popup blocker 
QuentinYangs-iPad:~ mobile$ ls /private/var/mobile/AppLinks/VLC\ for\ iOS.app/                      
Documents  Library  VLC for iOS.app  tmp

QuentinYangs-iPad:~ mobile$ ls /private/var/mobile/AppLinks/VLC\ for\ iOS.app -al
lrwxr-xr-x 1 mobile mobile 61 Apr 27 00:01 /private/var/mobile/AppLinks/VLC for iOS.app -> /var/mobile/Applications/B6D6835D-FD34-46E3-A465-13B35D4C5E0F

QuentinYangs-iPad:~ mobile$ ls /private/var/mobile/AppLinks/VLC\ for\ iOS.app/Documents/

QuentinYangs-iPad:~ mobile$ scp qyang@10.1.1.223:~/mntNAS/George_Data/Piano-Lessons/SkillSuccess-Piano-12.mp4 /private/var/mobile/AppLinks/VLC\ for\ iOS.app/Documents/

SkillSuccess-Piano-12.mp4            100%   12MB   1.1MB/s   00:11                                 
You can sync pdf books, photos and videos without iTune.
pdf file all renamed for iBook
QuentinYangs-iPad:~/Media root# ls /User/Media/Books/      
17AEB683BBA94B97.pdf  393CA8C01CE99509.pdf  55751370609C1376.pdf  75D5D27C4A0DC68B.pdf Books.plist       FCA490F8F9022998.pdf    iBooksData2.plist
2C55379B44DA1163.pdf  41BD49AE796A4C07.pdf  57022687E730FA09.pdf  88E410A3599CEFD2.pdf D1BA0918562153F7.pdf  FE57A71807FEA6FC.pdf
2C6E68A747BA2443.pdf  469A3390FC378AB6.pdf  66E27D1EFDACF4E5.pdf  9079674DB7AACD01.pdf E7A9DF25828E2D49.pdf  Purchases
2ED56E68AB4ADD8B.pdf  4715CD83FB89E35A.pdf  67CD967BE223DBF0.pdf  B19F69918E0558B3.pdf E96849ADDB5E816B.pdf  Sync
34FB1FC3BE0C1B97.pdf  5084BDA3A2D21205.pdf  6F9EB200DCC1887B.pdf  B40AB6478931EDA5.pdf ECFEA7B8487512B9.pdf  com.apple.ibooks-sync.plist
Photos are kept original name and not encrypted. *.PNG files are screen shot done on iPad. Import are files imported from CANON-40D.
QuentinYangs-iPad:~/Media root# ls /User/Media/DCIM/
100APPLE  100IMPRT  101IMPRT  102IMPRT 103IMPRT  104IMPRT  105IMPRT  106IMPRT 107IMPRT  108IMPRT  109IMPRT  110IMPRT
QuentinYangs-iPad:~/Media root# ls /User/Media/DCIM/100APPLE/
IMG_0001.PNG  IMG_0007.PNG  IMG_0014.PNG  IMG_0020.PNG IMG_0026.PNG  IMG_0035.PNG  IMG_0041.JPG  IMG_0047.JPG IMG_0057.JPG  IMG_0063.PNG  IMG_0071.PNG  IMG_0085.JPG
IMG_0002.PNG  IMG_0008.PNG  IMG_0015.PNG  IMG_0021.PNG IMG_0027.PNG  IMG_0036.PNG  IMG_0042.JPG  IMG_0048.JPG IMG_0058.JPG  IMG_0064.PNG  IMG_0074.PNG
IMG_0003.PNG  IMG_0009.PNG  IMG_0016.PNG  IMG_0022.PNG IMG_0028.PNG  IMG_0037.PNG  IMG_0043.JPG  IMG_0051.JPG IMG_0059.PNG  IMG_0067.JPG  IMG_0079.PNG
IMG_0004.PNG  IMG_0010.JPG  IMG_0017.PNG  IMG_0023.PNG IMG_0029.PNG  IMG_0038.PNG  IMG_0044.JPG  IMG_0052.PNG IMG_0060.PNG  IMG_0068.JPG  IMG_0080.PNG
IMG_0005.PNG  IMG_0011.JPG  IMG_0018.PNG  IMG_0024.PNG IMG_0030.PNG  IMG_0039.PNG  IMG_0045.JPG  IMG_0055.JPG IMG_0061.PNG  IMG_0069.JPG  IMG_0081.PNG
IMG_0006.PNG  IMG_0012.PNG  IMG_0019.PNG  IMG_0025.PNG IMG_0034.PNG  IMG_0040.PNG  IMG_0046.JPG  IMG_0056.JPG IMG_0062.PNG  IMG_0070.JPG  IMG_0084.JPG

Win to Mac GUI

Friday, December 30, 2016

epoch and date conversion in Linux command line


http://stackoverflow.com/questions/14805591/how-to-convert-strings-like-19-feb-12-to-epoch-date-in-unix

date --date="19-FEB-12" +%s
Current epoch:
date +%s
So, since your dates are in the past:
NOW=`date +%s`
THEN=`date --date="19-FEB-12" +%s`

let DIFF=$NOW-$THEN
echo "The difference is: $DIFF"

Convert epoch seconds to date

Convert seconds since the epoch (1970-01-01 UTC) to a date

$ date --date='@2147483647'

Details see $man date


qyang@ubuntu:~$ date +%w
6                                                           0 is SUN, 6 is SAT
qyang@ubuntu:~$ date --date='2-JAN-2017' +%w
1                                                           1 is MON
qyang@ubuntu:~$ date --date='2-JAN-2017' +%s
1483275600


qyang@ubuntu:~$ date --date='2-JAN-2017' +%s
1483275600
qyang@ubuntu:~$ ipython
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 

In [1]: 1483275600+60*24*60*60.
Out[1]: 1488459600.0

So, in 60 days from 2-Jan-2017 will be 3-Mar-2017:
qyang@ubuntu:~$ date --date='@1488459600.0'
Fri Mar  3 00:00:00 AEDT 2017

To calculate how many days between two dates:
qyang@ubuntu:~$ date --date='31-Dec-2016' +%s
1483102800
qyang@ubuntu:~$ date --date='6-Mar-2017' +%s
1488718800
qyang@ubuntu:~$ ipython
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
Type "copyright", "credits" or "license" for more information.
In [1]: (1488718800 - 1483102800)/(24*60*60.)
Out[1]: 65.0
It's 65 days from 31-Dec-2016 to 6-Mar-2017.

Sunday, December 25, 2016

Using Open DNS for Household Internet Monitoring



http://www.howtogeek.com/68886/how-to-configure-your-router-for-network-wide-url-logging/

https://www.opendns.com

BLOCK
c7.rbxcdn.com
facebook.com
game.weixin.qq.com
roblox.com
www.roblox.com
sumdog.com

pokemon.com
scratch.mit.edu

To block uTube:
youtube.com
googlevideo.com
youtube.l.google.com
ytimg.com
ytimg.l.google.com


NOT BLOCK
coolmath-games.com
play.google.com

Tuesday, September 13, 2016

Fix PAC Seg fault in Ubuntu 16.04



[1] https://sourceforge.net/p/pacmanager/bugs/271/
[2] https://sourceforge.net/p/pacmanager/discussion/1076055/thread/f6d6690e/


qyang@ubuntu:/opt/pac/lib/ex/vte32/auto/Gnome2/Vte$ cd /opt/pac/lib/ex/vte64/auto/Gnome2/Vte/
qyang@ubuntu:/opt/pac/lib/ex/vte64/auto/Gnome2/Vte$ ll
total 1.1M
-rw-r--r-- 1 root root 265K Nov  5  2015 Vte.so_64_5.022
-rw-r--r-- 1 root root  66K Nov  5  2015 Vte.so_64_5.020
-rw-r--r-- 1 root root  68K Nov  5  2015 Vte.so_64_5.018
-rw-r--r-- 1 root root 281K Nov  5  2015 Vte.so_64_5.016
-rw-r--r-- 1 root root 278K Nov  5  2015 Vte.so_64_5.014
-rw-r--r-- 1 root root  88K Nov  5  2015 Vte.so_64_5.000
drwxr-xr-x 3 root root 4.0K Jan  2  2016 ../
lrwxrwxrwx 1 root root   53 Jan  2  2016 Vte.so -> /opt/pac/lib/ex/vte64/auto/Gnome2/Vte/Vte.so_64_5.018
drwxr-xr-x 2 root root 4.0K Jan  2  2016 ./

qyang@ubuntu:/opt/pac/lib/ex/vte64/auto/Gnome2/Vte$ sudo rm Vte.so
qyang@ubuntu:/opt/pac/lib/ex/vte64/auto/Gnome2/Vte$ sudo ln -s /opt/pac/lib/ex/vte64/auto/Gnome2/Vte/Vte.so_64_5.022 Vte.so
qyang@ubuntu:/opt/pac/lib/ex/vte64/auto/Gnome2/Vte$ ll
total 1.1M
-rw-r--r-- 1 root root 265K Nov  5  2015 Vte.so_64_5.022
-rw-r--r-- 1 root root  66K Nov  5  2015 Vte.so_64_5.020
-rw-r--r-- 1 root root  68K Nov  5  2015 Vte.so_64_5.018
-rw-r--r-- 1 root root 281K Nov  5  2015 Vte.so_64_5.016
-rw-r--r-- 1 root root 278K Nov  5  2015 Vte.so_64_5.014
-rw-r--r-- 1 root root  88K Nov  5  2015 Vte.so_64_5.000
drwxr-xr-x 3 root root 4.0K Jan  2  2016 ../
lrwxrwxrwx 1 root root   53 Sep 14 13:30 Vte.so -> /opt/pac/lib/ex/vte64/auto/Gnome2/Vte/Vte.so_64_5.022
drwxr-xr-x 2 root root 4.0K Sep 14 13:30 ./

----
Uninstall and reinstall also fixed the issue after upgrade office Ubuntu from 14.04 to 16.04.
Pac start working in Unity rather than gnome.

$sudo apt remove pac
qyang@lgm-pc:~$ sudo dpkg -i ~/Downloads/pac-4.5.5.7-all.deb
Selecting previously unselected package pac.
(Reading database ... 333327 files and directories currently installed.)
Preparing to unpack .../Downloads/pac-4.5.5.7-all.deb ...
Unpacking pac (4.5.5.7) ...
Setting up pac (4.5.5.7) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160824-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
qyang@lgm-pc:~$ pac
PAC started (pac) with PID 23818
INFO: Used config file '/home/qyang/.config/pac/pac.nfreeze'
INFO: Using 'Unity' tray icon

Sunday, April 3, 2016

How to create Bootable USB Ubuntu 14.04 installation disk (UEFI and Legacy Compatible) and restore it back to full size after use

Linux Way to restore bootable USB:

Gui tool in lubuntu -> preferences -> Disks. (chose format USB disk as win95 fat32)

( Bootable usb write protected.
  $sudo mount -o,rw /dev/sdb1 /media/gyang/test
  or
  $mount -o remount,rw /media/gyang/test
  or
  $sudo hdparm -r0 /dev/sdb
  Not solving the issues.)



Windows Way:

You Tube Intro


Win32 Disk Imager 


superuser how to put USB back to original full size


Win32 Disk Imager to burn *.iso to USB flash drive.
Then, reboot from USB from UEFI enabled laptop. Should work. (Live CD has limitation as most new laptop no longer have CD drive.)

To restore USB flash drive. Follow step 5 in uTube video.


To restore bootable USB drive to its original size.

  1. Run CMD as Administrator
  2. Type DISKPART
  3. list disk
  4. select disk 1 (if your usb drive mine was 1)
  5. clean
  6. create partition primary
  7. active
  8. Choose a format:
    • FAT32 is the standard for USBs: format fs=fat32 quick
    • NTFS is more modern, but isn't as widely supported: format fs=ntfs quick
  9. assign
  10. exit
  11. exit

Saturday, April 2, 2016

Bit Torrent in Ubuntu



https://help.ubuntu.com/community/BitTorrent



qyang@ubuntu:~$ dpkg --list |grep transmission
ii  transmission                                                2.82-1.1ubuntu3.1                                   all          lightweight BitTorrent client
ii  transmission-common                                         2.82-1.1ubuntu3.1                                   all          lightweight BitTorrent client (common files)
ii  transmission-gtk    




Sunday, February 14, 2016

Saturday, January 2, 2016

Vi Error 'E185: Cannot find color scheme 'morning' in freshly installed ubuntu 14.04.3

Copied all ~/.vim folder to newly installed ubuntu box. But vi is complaining on start up. "E185: Cannot find color scheme 'morning'" Because at default it's using vim.tiny. qyang@ubuntu:~$ ll /etc/alternatives/vi lrwxrwxrwx 1 root root 17 Dec 6 13:24 /etc/alternatives/vi -> /usr/bin/vim.tiny* In old ubuntu box: qyang@lgm-pc:~$ ll /etc/alternatives/vi lrwxrwxrwx 1 root root 18 Jun 15 2015 /etc/alternatives/vi -> /usr/bin/vim.gnome Installing vim-gnome fixed this issue. ($sudo apt-get install vim-gnome)

Thursday, December 10, 2015

Install Playonlinux from command line to accept the license by Tab -> Enter

This POST addressed how to accept license when clicking enter doesn't respond the OK display when installing playonlinux from command line.
Solution:
Hit  key, then hit  to accept the license. 

That is it. So easy, just switching among buttons, to highlight button. Same like in windows.

Ubuntu apt mirror access error.


http://askubuntu.com/questions/553765/failed-to-fetch-update-on-ubuntu-14-04-lts-trusty-tahr


This post addressed one issue I had tonight.


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg  Unable to connect to us.archive.ubuntu.com:http:

Solution
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update

Or switch apt mirror from this link
http://askubuntu.com/questions/37753/how-can-i-get-apt-to-use-a-mirror-close-to-me-or-choose-a-faster-mirror

Friday, November 20, 2015

Cron and Anacron to schedule jobs in Linux


ref https://tecadmin.net/crontab-in-linux-with-20-examples-of-cron-schedule/

$crontab -e   to edit
$crontab -l   to list
$crontab -l -u username   to list cron jobs of username


anacron

runs commands periodically. Unlike cron(8), it does not assume that the machine is running continuously. Hence, it can be used on machines that aren't running 24 hours a day, to control daily, weekly, and monthly jobs that are usually controlled by cron.
qyang@lubuntu-laptop:~$ service anacron start
qyang@lubuntu-laptop:~$ service anacron status
● anacron.service - Run anacron jobs
   Loaded: loaded (/lib/systemd/system/anacron.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2015-11-21 09:19:57 AEDT; 4s ago
 Main PID: 10233 (anacron)
   CGroup: /system.slice/anacron.service
           └─10233 /usr/sbin/anacron -dsq

Nov 21 09:19:57 lubuntu-laptop systemd[1]: Started Run anacron jobs.
Nov 21 09:19:57 lubuntu-laptop systemd[1]: Starting Run anacron jobs...
Nov 21 09:19:57 lubuntu-laptop anacron[10233]: Anacron 2.3 started on 2015-11-21
Nov 21 09:19:57 lubuntu-laptop anacron[10233]: Will run job `cron.daily' in 5 min.
Nov 21 09:19:57 lubuntu-laptop anacron[10233]: Will run job `svnsyncPQAFW.daily' in 15 min.
Nov 21 09:19:57 lubuntu-laptop anacron[10233]: Jobs will be executed sequentially

cron

Sample of downloading data regularly using cron Changing crontab
root@trac ~# cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
17 * * * * root    cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#25 6 * * * root test -x /usr/sbin/anacron || ( cd /root/AuctionResults && run-parts --report /root/AuctionResults)
00 12  * * 7 root test -x /usr/sbin/anacron || ( cd /root/AuctionResults && run-parts --report /root/AuctionResults)
#
Run any executable files,eg.runpython under nominated folder AuctionResults
root@trac ~# ls -al ~/AuctionResults
total 852
drwxr-xr-x  2 root root   4096 Nov 15 12:00 .
drwx------ 11 root root   4096 Sep  9 00:41 ..
-rwxr-xr-x  1 root root   1105 Jul 14 13:48 file-retrieve-via-url.py
-rwxr-xr-x  1 root root     39 Jun  9 22:43 runpython
qyang@lubuntu-laptop:~/Svn_Local_Personal/A_001_Notes$ locate cron |grep bin
/usr/bin/crontab
/usr/sbin/anacron
/usr/sbin/cron
/etc/cron.daily/.placeholder
/etc/cron.daily/0anacron
/etc/cron.daily/apport
/etc/cron.daily/apt
/etc/cron.daily/bsdmainutils
/etc/cron.daily/dpkg
/etc/cron.daily/logrotate
/etc/cron.daily/man-db
/etc/cron.daily/mlocate
/etc/cron.daily/ntp
/etc/cron.daily/passwd
/etc/cron.daily/popularity-contest
/etc/cron.daily/update-notifier-common
/etc/cron.hourly/.placeholder
/etc/cron.monthly/.placeholder
/etc/cron.monthly/0anacron
/etc/cron.weekly/.placeholder
/etc/cron.weekly/0anacron
/etc/cron.weekly/fstrim
/etc/cron.weekly/man-db
/etc/cron.weekly/update-notifier-common
/etc/default/anacron
/etc/default/cron
/etc/init/anacron.conf
/etc/init/cron.conf
/etc/init.d/anacron
/etc/init.d/cron

service control in debian/lubuntu/ubuntu - sysv-rc-conf


[1] wiki.debian.org

Install sysv-rc-conf via apt.
$sudo sysv-rc-conf