Friday, August 2, 2019

how to format number to for the amount of money with libreoffice calc

TEXT(SUM(E1079:E1093), "##,###.00")

Wednesday, May 8, 2019

Renaming multiple files with Emacs / การเปลี่ยนชื่อไฟล์หลายๆไฟล์อย่างคล่องแคล่วด้วย Emacs

We can easily renaming multiple files with Emacs's Dired.

เราสามารถแก้ไขชื่อไฟล์จำนวนมากได้อย่างสะดวกด้วย Emacs's Dired เราใช้ Dired เปิด Directory ที่ต้องการ เราจะเห็นรายการไฟล์ใน Buffer จากนั้นเราสามารถใช้คีย์ของ Emacs ที่เราใช้ Edit Text ต่างๆตามปกติในการแก้ไขชื่อไฟล์ได้เลยอย่างสะดวกสุดๆ เมื่อแก้ไขจนจุใจแล้ว เราเพียงกด ctrl+c ctrl+c ชื่อไฟล์ทั้งหมดก็จะถูกเปลี่ยนทันที
  1. alt+x dired
  2. ctrl+x ctrl+q
  3. edit the file names / ทำการแก้ไขชื่อไฟล์ทั้งหมด
  4. ctrl+c ctrl+c

Reference / อ้างอิง:

  • http://ergoemacs.org/emacs/rename_file_pattern.html

Tuesday, April 16, 2019

Samsung Galaxy Note 8 Battery Draining Too Fast Issue (Resolved!)

To resolve this issue:

  1. Use only 3G (Settings > Connections > Mobile networks > Network mode -> 3G only)
  2. Use Medium Power Saving mode, no need to Restrict Background Data, only need to Limit the CPU's speed (Settings > Device care > Battery > Power mode)
  3. Turn Data Saver on and allow only the following apps to use data in background:
    1. Google Play services (might have two duplicate names)
    2. Google Play Store (unless you can leave the screen open and active all the time every time there is a software update which I find it's quite annoying)
    3.  All the instant messaging apps
    (Settings -> Connections > Data usage > Data saver)
With these settings, when you don't use your phone, the battery level will go down very slowly.  The battery level will go down only when you use your phone.  Full 24 hours is now possible.

Monday, March 18, 2019

git alias

$ git config --global alias.co checkout
$ git config --global alias.br branch
$ git config --global alias.ci commit
$ git config --global alias.st status

Saturday, March 16, 2019

How To Load Quicklisp Automatically From A Top-Level Script

In your .sbclrc file...

Common Lisp Resources

ASDF
General Development

Web Development
Tools
FAQ

Tuesday, March 12, 2019

How To Record Terminal And Replay It

$ script -t 2>~/upgrade-stretchstep.time -a ~/upgrade-stretchstep.script
$ exit
$ scriptreplay ~/upgrade-stretch.time ~/upgrade-stretch.script

References:

Saturday, February 23, 2019

How to transferring a pair of Mdadm Raid-1 hard drives from a machine to another machine

After removing the two drives from the first machine and installing them to the second machine, turn the machine on.  Debian will see them as /dev/md127.

Assuming you want to rename the md device to be `data`, you can do it by performing the following steps:
  • `sudo mdadm --stop /dev/md127`
  • `sudo mdadm --assemble /dev/md/data --name=data --update=name /dev/xdvi1 /dev/xdvj1`
  • `sudo mdadm --detail --scan`
  • You will get something like this, `ARRAY /dev/md127 metadata=1.2 name=tmp-mdadm:127 UUID=af8d2901:f37333e6:d8490a00:2855a00e`
  • If you want to name the md device as "data", you put `ARRAY /dev/md/data metadata=1.2 name=tmp-mdadm:data UUID=af8d2901:f37333e6:d8490a00:2855a00e` into the file `/etc/mdadm/mdadm.conf`.
  • `sudo reboot` 

Just to add to haimg's excellent answer. It may happen that even with a mdadm.conf, the system (at least for Ubuntu) may still auto-assemble the arrays prior to reading mdadm.conf. So when it finds it it just ignores the arrays that have just been assembled anyway.

To account for that, run sudo update-initramfs -u to regenerate the proper initrd.

References:

Monday, February 18, 2019

how to restore files from backup with duplicity

duplicity restore --no-encryption --file-to-restore "some/directory with space in its name" --time "2019-02-17T18:00:05+07:00" file:///data/my-important-backup-dir