The Wall

14 十二月, 2020

Their wedding picture mocked them from the other table,
these two whose minds no longer touched each other.

They lived with such a heavy barricade between them
the neither battering ram of words
nor artilleries of touch could break it down.

Somewhere, between the oldest child’s first tooth
and the youngest daughter’s graduation,
they lost each other.

Throughout the years each slowly unraveled
that tangled ball of string called self,
and as they tugged at stubborn knots,
each hid his searching from the other.

Sometimes she cried at night and begged
the whispering darkness to tell her who she was.
He lay beside her, snoring like a hibernating bear,
unaware of her winter.

Once, after they had made love,
he wanted to tell her how afraid he was of dying,
but fearful to show his naked soul,
he spoke instead of the beauty of her body.

She took a course on modern art,
trying to find herself in colors splashed upon a canvas,
complaining to the other women about men
who are insensitive.

He claimed into a tomb called “The Office,"
wrapped his mind in a shroud of paper figures,
and buried himself in customers.

Slowly, the wall between them rose,
cemented by the mortar of indifference.

One day, reaching out to each other,
they found a barrier they could not penetrate,
and recoiling from the coldness of the stone,
each retreated from the stranger on the other side.

For when love dies, it is not in a moment of angry battle,
not when fiery bodies lose their heat.
It lies panting, exhausted
expiring at the bottom of a wall it could not scale.

— Author Unknown

(copied from How we love by Kay and Milan Yerkovich, Chapter 17, Engage)

Keep screen on forever in Android

26 七月, 2019

To use old Android device as a clock / digital photo frame you probably need this.

This is the adb method. Do the following:

    1. Developer options -> TCP debugging (if not plugging in USB cable); otherwise, adb tcpip 5555 with USB cable plugged in, then unplug.
    2. Take note of the IP address, then adb connect <ip>
    3. adb shell settings get system screen_off_timeout gives 60000 for timeout of 1 minute
    4. adb shell settings set system screen_off_timeout 2147483647 so it would be on forever (or at least ~24 days at a time)

 

Fix up photo timestamps

7 二月, 2019

Went to a trip but forgot to adjust the time, or came back from a trip but forgot to set it back? (My new Lumix LX10 has the ability to set the length of the trip up front and avoids having to reset time after your trip, but my other camera is not there yet)

  • (optional) before you experiment with the script you may want to make a backup first
  • Find out by how many hours you want to shift the timestamps forward (+=) or backward (-=), then
    • exiftool -AllDates-=16:00 photo.jpg # shift back 16 hours
    • exiftool -AllDates="2016:12:17 12:00:00" photo.jpg # set to a specific timestamp
    • exiftool keeps the original file by renaming it with “_original" extension, keep them until you’re happy with the result
    • file size does change a bit but it does not touch the image portion of the file
  • To keep the original modified / created date on Mac, do
    • exiftool -CreateDate photo.jpg
    • This gives “Create Date : 2018:01:03 23:45:53″
    • touch -t 201801032345.53 photo.jpg
    • Combine the above two steps in an automated fashion:
    • for i in photo.jpg; do
      touch -t `exiftool -CreateDate $i | awk '
      BEGIN{FS=":"} {printf("%s%s%s%s.%s",$2,$3,$4,$5,$6)}
      ' | sed 's/ //g'` $i; done
    • Replace photo.jpg with *.jpg (or your raw file formats)—done!

5Ghz AP on Raspberry Pi 3B+

28 十一月, 2018

Summary: 5Ghz Access Point on 802.11n, 40Mhz, on Raspberry Pi 3B+.

Started off with Raspbian Lite image burned onto microSD card, with Etcher. When done, eject the card and re-insert, add an “ssh" file on the boot partition to enable ssh:

touch /Volumes/boot/ssh # or wherever the boot partition is

Upon first boot, set wifi country code with

sudo raspi-config

My understanding is that would add this “country=US" line to this file so wifi can be turned on:

$ cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

This is the guide I followed, good for Raspbian Stretch: http://www.raspberryconnect.com/network/item/333-raspberry-pi-hotspot-access-point-dhcpcd-method

This is my “hostapd.conf" I ended up with:

$ cat /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
ssid=name_of_access_point # rename this
hw_mode=a
channel=48
wmm_enabled=1
ieee80211n=1
require_ht=1
ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40]
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=dont_tell_others # change this
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Compared to the guide, there are these differences:

hw_mode=a # instead of g
wmm_enabled=1
ieee80211n=1
require_ht=1
ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40]
channel=48 # see ht_capab in the hostapd.conf below for possible combinations of ht_capab and channel

For more details refer to https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf; it is very long though.

Result (on Mac, press and hold Option button while click on the wifi icon to see this): Screen Shot 2018-11-27 at 10.44.07 PM

I’m getting 71Mbps over this AP for speed test, which is the speed of my internet, and much better than the 28Mbps with my old travel router on 2.4Ghz band.

Seems you can only choose between 2.4Ghz and 5Ghz and not both at the same time: https://raspberrypi.stackexchange.com/questions/82102/is-it-possible-to-use-raspberry-pi-3-b-dual-band-wifi-simultaneously , hence I still need the other router to provide 2.4Ghz connection for IoT / old devices.

(edit) Even though the chip supports 80Mhz bandwidth (VHT), currently it cannot make use of it due to this issue: https://github.com/raspberrypi/linux/issues/2619 indicates that if you set the country to some countries in EU it wouldn’t work on 80Mhz. I could make it work by changing the few lines as suggested in this issue link as:

channel=36 # instead of 48 above; again check the list of possible channels with 80211ac
ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40] # changed from [HT40-] to [HT40+] since channel 36 is used and added [DSSS_CCK-40]

ieee80211ac=1
require_vht=1
ieee80211d=0
ieee80211h=0
vht_capab=[SHORT-GI-80]
vht_oper_chwidth=1
vht_oper_centr_freq_seg0_idx=42

However it’s not as stable as before due to undervolting (I don’t have the best power supply) and I have to add a few lines to the /boot/config.txt:

arm_freq=1000 # down from default of 1400 on 3B+
dtoverlay=pi3-disable-bt # since I’m not using bluetooth anyways; not sure how much this helps though.

Even undervolting warning goes away (sudo dmesg), I still don’t have a stable connection, not sure why yet and I’m reverting back to 80211n mode for now.

How can I speed up SD card writing speed (using /dev/disk*) on a MacBook Pro?

6 九月, 2017

https://apple.stackexchange.com/questions/56159/how-can-i-speed-up-sd-card-writing-speed-using-dev-disk-on-a-macbook-pro

When one character “r" means 83.8x speed difference:

https://apple.stackexchange.com/…/how-can-i-speed-up-sd-car…
“Apparently a BSD thing"

On Lexar 633x microSDHC card:

sudo dd if=image-to-be-written.img of=/dev/disk4 bs=1m
214.2KB/sec

sudo dd if=image-to-be-written.img of=/dev/rdisk4 bs=1m
17.54MB/sec (83.8x the one above)

錄港台節目(二)

22 一月, 2016

幾年前港台轉了不用RealAudio格式,我也少了聽電台。最近想繼續聽音樂情人,又要去找方法錄。試了幾個網上找到的方法*,終於試到一個好的,如下:

安裝 livestreamer

# pip install livestreamer

安裝 ffmpeg

請到 https://www.ffmpeg.org/ 去下載並安裝 ffmpeg

找出節目 .m3u8 鏈結

請參考 http://tylau0.blogspot.com/2014/03/download-rthk-audio-programme-archive.html 一文找出 .m3u8 鏈結,如

http://stmw1.rthk.hk/aod/_definst_/radio/archive/radio1/musiclover/mp3/mp3:20160118.mp3/playlist.m3u8

http 換成 hlsvariant 然後下載

$ livestreamer “hlsvariant://stmw1.rthk.hk/aod/_definst_/radio/archive/radio1/musiclover/mp3/mp3:20160118.mp3/playlist.m3u8″ best -o 20160118.ts

用 ffmpeg 將 .ts 檔轉成 .mp3

$ ffmpeg -i 20160118.ts -acodec copy 20160118.mp3

剪mp3

請參考 https://yukhei.wordpress.com/2008/10/05/record_radio_program/ 如何飛走新聞

bash script

待續。。。

* 用 ffmpeg -i 錄出來的會條線(過程中 ffmpeg 回報有錯誤),所以才要去找另外的方法。

Convert mp3 tag to utf8

2 一月, 2014

find . -iname "*.mp3" -execdir mid3iconv -e big5 {} \;
You can replace big5 with gbk, if so needed.

Prerequisite: sudo apt-get install python-mutagen (on Ubuntu).

Writing EXIF data for adapted lens using exiftool

29 八月, 2013

To write EXIF data for my adapted Konica Hexanon 40mm f/1.8 lens I used this command:

exiftool -FNumber="2.8" -MaxApertureValue="1.8" -FocalLength=40 -Lens="Konica Hexanon 40mm f/1.8" PHOTO.JPG

For cameras of other brand you might want to use
-ApertureValue="2.8" instead of (or in conjunction to)
-FNumber="2.8".

A backup will be made with name PHOTO.JPG_original.

Interestingly the size of edited photo is smaller, so I wonder if some details are lost (I don’t think so, but I haven’t figured out yet).

When I copied the modified JPG back to the card, the camera read the focal length correctly, but f/2.8 appeared as f/2.4… (edit: MaxApertureValue uses APEX values not F-Stops. c.f. http://photo.stackexchange.com/questions/19143/how-can-the-aperture-value-written-in-exif-be-larger-than-the-nominal-limit-of-t)

(Added Feb 15, 2016: To copy tags from one photo to another — http://thomer.com/howtos/copy_exif.html)

Rokkor lens

21 八月, 2013

http://www.rokkorfiles.com/

Some of them can focus at 30 cm (12 inch).

Konica Hexanon lens

19 八月, 2013

http://www.buhla.de/Foto/Konica/Objektive/e50_17.html

These could be found for less than $50, for use with an adapter on m4/3 systems.