Saturday, December 30, 2017

Speeding Up an Old iPad

Was gifted a pre-loved iPad 2 (64GB, WiFi, Model A1395) in time for my kid's new school year, which requires a BYOD (bring your own device). As expected, the tablet of choice by the school is an Apple iPad. Good thing they didn't specify a particular model.

The iPad 2, with its 132 ppi resolution and 1 GHz dual-core A5 processor, is starting to show its age, but still runs fine, though a bit sluggish. Most of the "suggested" apps downloaded and installed just fine on IOS 9.3.5. A few required IOS10 or IOS11, and simply won't install. Apple's iWork productivity suite (Pages, Numbers, and Keynote) and GarageBand reported incompatibility with the iPad.

As a workaround, go to the App Store app, and tap on Purchased. Select "Not on this iPad". Select again the apps that wouldn't install. If there is an older version that is compatible with the current firmware/hardware, you will be given the option to download that instead. Managed to get the iWork apps installed this way.

Next step is to speed up the old clunker. Most obvious choice is to disable the features that you don't really need:
  • Spotlight indexing
  • App Store auto-update
  • background app refresh
  • notifications
  • multi-finger gestures
  • keyboard auto-correct, auto-capitalizaiton, check spelling
  • location services
  • perspective zoom on the home and lockscreen wallpapers
  • transparency
You can also enable reduce motion, deleted rarely-used apps to recover diskspace, upgrade to the latest IOS, and restart the iPad once in a while.

Rotating Vertical Videos

Everyone on the Internet is saying never to take videos in portrait mode (vertically). However, there are some scenarios that call for vertical videos, much like pictures that look better in portrait mode.

Thing is, once downloaded from my DSLR, those vertical videos show up as horizontal videos on my PC, with the subject lying down. Usually, I just use Freemake Video Converter to rotate them into portrait mode again. However, there are some videos that Freemake is not able to handle, for whatever reason. The MOV file loads fine, but when I click the "Edit/Play" button, the program (version 4.1.10) just quits/exits with no warning. Thanks to Google, I found a way to do the same thing using VLC.

So this is how to rotate your portrait-mode videos:

  1. Run VLC.
  2. Under Tools, selects Effects and Filters (Ctrl+E).
  3. Click on Video Effects tab, then click on Geometry sub-tab.
  4. Enable Transform, and select "Rotate by 90 degrees" from the drop-down list, and click Close. There is another option to Rotate, but this is more if you want to rotate using a specific angle, instead of the preset ones.
  5. Go back to Tools --> Preferences. Under Show settings, select All.
  6. From the left pane, select Stream output, then Sout stream, then Transcode.
  7. Under Video filter, enable Video transformation filter. Click Save.

You can test that the whole process works by playing your vertical video. It should now play right side up.

And this is how to convert the video permanently:

  1. Under Media, select Convert/Save (Ctrl+R).
  2. Add the video file you want to rotate.
  3. Click on the drop-down arrow beside the Convert/Save button and select Convert (Alt+C).
  4. Specify a destination file for the converted output.
  5. Default profile is MP4 container using H.264 video and MP3 audio. Click on the Tools icon on the right to edit the settings.
  6. Click on the Audio codec tab. Select MP3 as codec and sample rate of 48000. This is so because my original video uses PCM and 48000 sample rate, which I'd like to keep.

So far, this gives me the best results. I tried the "Keep original video track" option to preserve video quality, but in this case, the video was not rotated.


Wednesday, December 27, 2017

Grand Pacific Drive Day Out

Planned the day's itinerary using Google search. As simple as typing in "Sydney Wollongong itinerary". Next step is to put in the multiple stops in Google Maps as one trip.

First stop is the Sri Venkateswara Temple in Helensburg, around an hour's drive away. Been to this Hindu temple before, but never went in. Nothing much to it, all you need to do is to take off your footwear. High ceilings, open spaces, mats on the floor for devotees to sit on, hundred of deities all round the temple. Behind the temple is a hall for functions, and a canteen serving food for eat-in or takeaway.

Next stop is the Bald Hill Lookout. Don't make the mistake of putting in Stanwell Tops Lookout in Google Maps. It'll take you to a totally different spot. Bald Hill Lookout is where you get 180-degree panoramic view of the Illawara escarpment, the Sea Cliff Bridge and the Tasman Sea. It's also quite popular with hang gliders. The Sydney Hang Gliding Centre is just nearby. There's also a monument to Lawrence Hargrave, an Australian pioneer of flight.

Driving down Lawrence Hargrave Drive, it eventually becomes the 665-meter long Sea Cliff Bridge. Thought of taking a short bridgewalk, but all available parking spaces along the bridge are taken.
Took a right at Cliffton School Parade after the bridge and stopped at Rube Hargrave Park. There's a nice playground for the kids and a public toilet. Parking is limited, but doesn't matter as the tourists simply parked along both sides of the street. A group of Chinese tourists even took the last remaining disabled parking. None of them looked disabled to me. Across the highway is the Moronga Park. Took a short stroll on the bridge and went back, as it started to get hot.

Next stop is Austinmer Beach, about 10 minutes' drive away. There's a carpark between the beach and the drive, but it's usually full. Street parking is not much better. Lunch is basically burger, fish and chips and chicken nuggets and chips from Shells Diner. Then, it's off to the rock pools to get our feet wet. There are toilets and showers and change rooms nearby.

Original plan was to go to the Wollongong Lighthouse, then Nan Tien Temple. However, as time is running short, we decided to head straight for Kiama instead. That's another hour of driving. Got to see the blowhole in action and the lighthouse. Farmer's market is on from 3pm till 6pm, but there's absolutely no parking spot to be found nearby. Time to head home.

Monday, December 18, 2017

Mr. Robot Fight Club

So I heard some good things about Mr. Robot. Being a computer nerd, I decided to watch the series.

It starts off interesting enough. Interesting plot, quirky characters, believable hacking scenarios. Geeky cyber-security engineer saves his company's biggest client from a malicious cyber attack, and becomes entangled with a hacker group called fsociety, who wants to bring down E Corp, the world's largest conglomerate.

Thing is, the more episodes I watched, the most I felt I've seen this before.

  • Long, gloomy shots with an olive-green tint? Check.
  • The loner main character, who has bouts of depression and paranoia? Check.
  • An underground group who wants to destoy consumer debt records, so everyone gets a clean slate? Check.
  • An alter ego who occassionaly takes over and runs the show without the person's awareness?? Tyler Durden, is that you? No, it's Mr. Robot!

Needless to say, I stopped watching Mr. Robot after season one.

Friday, November 24, 2017

iA Writer - Denote Alternative

Just noticed that my Denote notes on the smartphone are not being synced back to Dropbox. I did change my Dropbox password recently, so I thought that must've been the problem.

On Denote, I don't see any option to change/update the Dropbox password, so I assume it's probably done during initial setup after installation.

I promptly uninstalled and re-installed Denote. No prompt to sync with Dropbox. While most newer apps would have a three-dot settings/overflow icon on the action bar, none can be found anywhere in the UI. Given that Denote was last updated October 2013, I'm not surprised.

Some tablets and mobiles have a bottom navigation bar, which may be used to call up the settings menu, but my Samsung Galaxy S7 does not display this. After some research, the workaround is to enable Assistant menu under Accessibility --> Dexterity and interaction. A floating icon shows up where you can call up the settings menu. From this point on, I was able to get Denote to start talking to Dropbox. However, my notes are still not showing up.

Turns out Dropbox dropped support for its v1 API on Sept 2017 in favour of v2. 2Storks, the developer of Denote, didn't update the app to make use of v2, hence sync functionality is broken. I was thinking of switching to Textfile, but turns out that that one was also not updated.

All I want is a text editor that syncs (two-way) with Dropbox. After evaluating a few apps, it came down to Monospace and iA Writer.

Despite what Monospace says, I can't find the option to sync with Dropbox. Syncing with Google Drive is a pro/paid feature. That said, I quite like the hashtag feature for file organization.

From my limited time with iA Writer, it seems to fit the bill. Syncs properly with Dropbox. Even supports Markdown. Swipe left and right to change views.

Tuesday, October 17, 2017

Check Running Process

What we'd like to do here is to check for the presence of a running process. If present, do x (echo Running). If not, do y (restart said process).

First step is typically done by running ps and doing a grep on the output for the process name (ps -ef|grep process). This merely checks for presence and not the state of the process. In the case of no match, grep will still match the original grep command, thus reporting a hit. To get around this, do an inverse-match for grep (ps -ef|grep -v grep|grep process). Another option is to use pgrep.

So you'd have something like this:
#!/bin/sh

if ps ax | grep -v grep | grep process > /dev/null
then
    echo "Running"
else
    echo "Not running. Starting."
    /opt/process/bin/process restart
fi

If you plan to run the script as a cron job, best to silence all output (/opt/process/bin/process restart &> /dev/null).
Or better yet, run the check commands as the cron job itself (every 15 minutes):
*/15 * * * * pgrep process > /dev/null || /opt/process/bin/process restart &> /dev/null

Cron, Cron Jobs, and Crontab

Cron in a Linux/Unix utility/daemon that runs tasks (cron jobs) in the background at regular intervals.
A crontab (cron table) is basically a file that contains the schedule of cron jobs to be run at specific times.

  • crontab -l to list the crontab entries
  • crontab -e to edit the crontab file
  • crontab -r to remove your crontab file

Cron entries use the following syntax:
*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6, where Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)

Entry: Minute when the process will be started [0-60]
Entry: Hour when the process will be started [0-23]
Entry: Day of the month when the process will be started [1-28/29/30/31]
Entry: Month of the year when the process will be started [1-12]
Entry: Weekday when the process will be started [0-6] [0 is Sunday]

* in the minute field means command will be executed every minute.
*/10 means command will be executed every minute. This repeat pattern is not supported by all OS, so better to just use 0,10,20,30,40,50.
You can also use "-" to represent a range of values. For example, 0 1-2 * * * means command will be run at 1am and 2am only.
For readability, you can also use sun, mon, tue, wed, thu, fri, or sat for day of the week. 7 is also acceptable for Sunday.

After editing the crontab, remember to run "service crond reload" to take the new jobs into effect.

Not sure about your crontab syntax? Try crontab.guru.

Friday, October 13, 2017

STDIN, STDOUT, and STDERR

Have started scripting again, and have forgotten all about stdin, stdout, and stderr - and the various syntaxes. Time for a refresher.

Ok, so if I was to do an ELI5:
Every process is initialized with three open file-descriptors: stdin (standard input), stdout (standard output), and stderr (standard error).

  • stdin (file handle 0) is where the process gets input from you (usually from the keyboard or from pipes)
  • stdout (file handle 1) is where process output is displayed (usually sent to the console or a file or a pipe)
  • stderr (file handle 2) is basically stdout for errors (usually to stdout unless redirected elsewhere)

Let's take this for example:
myscript <infile 2>errfile

  • A process is created for myscript.
  • infile is opened as standard input for myscript (file handle 0)
  • errfile is opened as standard error (file handle 2)
  • myscript output is sent to /dev/tty by default (file handle 1)

Separating stderr from stdout is a great idea when you know command execution will result in errors, and you don't want them cluttering up valid entries in your stdout. Great example is when you're grepping for something. Most of the time, you get one or two hits, yet stdout is filled with "Permission denied" entries for protected directories. What to do?

grep needle /home/haystack/* > results.txt
Valid results redirected to results.txt; bad results displayed on the console.

grep needle /home/haystack/* 2> errors.log
This time, stderr (2) is redirected to errors.log, while valid results are displayed on the console.

grep needle /home/haystack/* &> output.txt
With this, everything (stdout and stderr) is redirected to output.txt, with nothing sent to tty.

If you want all results displayed on screen and saved on file, pipe them to tee:
grep needle /home/haystack/* |& tee output.txt

If your version of bash is giving you a syntax error, try this less elegant version:
grep needle /home/haystack/* 2>&1 | tee output.txt
This basically redirects stderr (2) to stdout (1).
1>&2 redirects stdout (1) to stderr (2).

What if you simply do:
grep needle /home/haystack/*  | tee results.txt
You get stdout on the screen and in the file, but the console will also display stderr.

Note that the above examples will overwrite if the file exists. Use >> and tee -a to append.

Wednesday, October 4, 2017

Xiaomi Xiaofang 1080P Wireless IP Camera Review

Found some time to finally sit down and write a review of the Xiaomi Xiaofang WiFi IP camera. The camera itself is a glossy white 50mm plastic cube - lens assembly in front, speaker, status LED and USB ports (full-size and micro-USB) at the back, and microSD slot, air vent and reset button at the bottom. The articulated arm and swivel base adds another 6mm to the height. Weight is 100g.

For the price, I'm very impressed with what it supposedly can do.

  • 1080P (1920x1080) full HD resolution video feed via the f2.0 aperture 110-degree lens. If you position two Xiaofangs together, the app supposedly creates a 220-degree panorama.
  • The lens assembly also has an IR-cut double filter with 2 infrared LEDs, which provides night vision up to 9 meters. (You can hear a click when the filter cuts in.)
  • The Mi Home app for the Xiaofang has a Speak button, which enables the intercom functionality.
  • The camera also come with smoke and CO alarm monitor function. Basically, it uses sound recognition to detect that the smoke or CO alarm has triggered, and then sends you a notification.
  • The camera can be configured to record video constantly onto the microSD card (64GB max) or only when motion is detected. Taking of timelapse photos also supported. The videos are also synced to Xiaomi's cloud storage (free!), so you can access/view them remotely.
  • While watching the realtime video feed, you can take stills or record video.
  • Network connection is via WiFi (2.4GHz 802.11 b/g/n). Remote access via WiFi or cellular network.
  • The camera requires 5VDC 1A and is powered via the microSD port. Given that USB ports are almost everywhere (heck, you can even use powerbanks), that opens up options where the Xiaofang can be installed. Add that magnetic base into the mix, the options are limitless!

Initial setup is a bit tricky though, if you don't understand Chinese/Mandarin.
  1. First off, download the Mi Home app from the Google Playstore. The retail box comes with a QR code, which should give you the link, or just do a search from within the Playstore.
  2. Set your location/locale to Mainland China, or the camera will not work. Apparently, it's not supposed to be used outside of China.
  3. Log in to your Xiaomi account, or create one if you don't have one yet.
  4. Click on the "+" icon to Add Device. Select the Xiaomi Xiaofang from the list. Note that you might see two entries. Choose the one with the shorter title, as the other one is for WiFi Direct mode.
  5. Apply power to the camera.
  6. Long press the setup button at the bottom, until you hear a voice prompt, which says/means "Waiting for connection".
  7. At this point, enter the credentials for the WiFi network that the camera is supposed to connect to using the Mi Home app.
  8. Point the camera to the Mi Home, which should now be showing a QR code. Another voice prompt will indicate successful connection.

Note that the camera's default setting is to auto-record. Might want to turn that off.

Been playing with the camera for a couple of days now, and so far so good. Most of the features work as advertised - speak, audio, full screen, look back, timelapse, night vision, and dormancy. There are a few times when I cannot connect to the device, but it's easily fixed with a power reset. Not so convenient when you're in a remote location.

Motion detection is a bit sensitive. The clouds would pass by, changing the sunlight patterns on the blinds, and that's enough to trigger motion detection. Downloading videos also take a while, probably because they're coming from some server in China. Motion-detect videos seems to be limited to 16 seconds.

The camera comes with firmware version 3.0.3.56. The app has been nagging me to upgrade to 3.2.0.30, which I'm holding off, as there are reports that after upgrade:

  • IR LEDs do not turn off even during daytime
  • Camera not working when used outside China (geoblocked?)
  • microSD card not detected

There is an option to lock down access the camera with a PIN password or fingerprint, but not sure how secure that really is. *cough* backdoor *cough*

For those who don't want the video feeds going to China, there is an option to apply some hacks via the microSD card to disable cloud service and stream via RTPS. That said, some of the functionalities become broken. Installation instructions here.

All in all, a neat little WiFi security camera.

Saturday, September 30, 2017

LineageOS 14.1 on the Galaxy S4 Mini

Ever since the wife started using the LG G Pro 2 (D838), the Samsung Galaxy S4 Mini (GT-I9195T) has been gathering dust on a shelf. Decided to put a custom ROM on it, and was pleasantly surprised that it's already running CM13.1 (Android 6.0.1). Can't remember when I did that. And given that it already has a TWRP custom recovery on it, flashing LOS14.1 on it is a cinch.

Download latest firmware here:
https://download.lineageos.org/serranoltexx

Get Google Apps here:
http://opengapps.org/
Choose either the pico, nano, or micro variant of the Android 7.1 gapps (ARM platform).

If you want to get root, download the addonsu package from https://download.lineageos.org/extras

Copy all three files to a microSD card, and let's start.

  1. Boot into recovery (Vol Up & Home & Power).
  2. Wipe the Cache, System, and Data partitions.
  3. Flash the LOS firmware, gapps, and the addonsu zips.
  4. Reboot system.

First boot takes a very long time, so don't be tempted to restart the phone. Just let it finish its work. Once booted, Go to Settings, About Phone. Tap the build number seven times to enable Developer Options. Change root access to your desired method.

Sunday, September 17, 2017

Xiaomi Mijia Infrared Motion Sensor Dimmable LED Night Light Review

For this post, I'm reviewing the Xiaomi Mijia night light. Well, the title pretty much mentions all the features of this item.
  • The light has 120-degree sensing angle and sensing distance up to 5 to 7 meters. Using advanced photosensitive sensor and human infrared sensor technology with anti-infrared interference function, the light can turn on automatically in the dark and light up for 15 seconds.
  • The light is powered by 3 AA batteries (not included). In standby mode, ultra-low power consumption of only 0.25mW. Toggle switch chooses between two luminance levels - 0.7Lm and 3.8Lm, with battery life of 12 months and 6 months, respectively.
  • Applied Fresnel ultra-thin lens to enhance the sensor performance. Fish scale total reflection structure reflect the light to the diffuse reflector and the light spreads evenly in the lampshade to bring a better visual experience.
Okay, first impression. The night light is much smaller than what I expected, having only seen it from the online product listings. The build and finish is excellent though - clean and minimalist. The top and side surfaces of the night light is very smooth, with some grooves at the bottom to provide some grip. Still took me a while to open up the night light to install the three AA batteries.

It works as advertised. Doesn't activate or turn on during daytime. In the dark, it senses movement almost instantaneously, even from afar, and lights up. Even at 3.8Lm, the 2700K warm white light is not too glaring, yet bright enough to light up its immedate surroundings. Light comes out from a circular strip around the top surface. Output is quite uniform and even.

In terms of installation, it can be attached to flat surfaces via double-sided tape. A plastic film with a hole can be stuck to the night light, which can them be suspended/mounted on a hook or nail. In my case, it's just positioned on the floor facing the hallway entrance. Turns on every time someone passes by.

Tuesday, September 12, 2017

Book 2017.09.12 - The Boy Kings: A Journey into the Heart of Social Network

As employee number 51, Katherine Losse writes about her stint at Facebook. From her start as a lowly $20/hour customer support to internationalization product manager to Mark Zuckerberg's ghost writer.

It was an interesting read on how Facebook developed into the all-encompassing behemoth it is now - Mark's obsession on being "technical" and making everything "transparent". Lots of anecdotes about the boy kings and personalities who make up Facebook and philosophical musings about real life, friendships, connections, and technology.

The tl;dr version - Facebook may be good for your "social" life, but not your social life.

After five long years with Facebook, Kate had enough of the cult, and sold off her Facebook shares (pre-IPO), and moved to Marfa, Texas to write this book.

The parting paragraph: "I think that this may be the truth of these technologies that we carry around: We film and post and read social media constantly in order to capture something, some exciting moment or feeling or experience that we are afraid to miss, but the things about life that we most want to capture may not be, in the end, capturable. And, perhaps, planning and efficiency themselves, the things that technologies like Facebook want to make easy and constant, are not as easily grasped as we think. Because, in all of our newfound efficiencies, what have we lost? What, like the moment at the Ice Plant when the glass shattered, is too unplanned and ephemeral to predict and capture with our technologies? Should we keep trying, or should we take a breath, and let some things go unshared and unrecorded, realizing that this ineffability may be the essence of life itself?"

Sunday, September 10, 2017

張惠妹 - 快樂眼淚

張惠妹 - 快樂眼淚

作詞:林夕
作曲:楊陽
編曲:吳慶隆



看著你久違卻 熟悉的臉龐
kan zhuo ni jiu wei que shu xi de lian pang
那些煙遠往事 畫上了圓滿
na xie yan yuan wang shi hua shang liao yuan man
因為你快變成 別人的新郎
yin wei ni kuai bian cheng bie ren de xin lang

你終身的對象 一定很理想
ni zhong shen de dui xiang yi ding hen li xiang
否則你又何必 終止糾纏
fou ze ni you he bi zhong zhi jiu chan
只好微笑祝福 你們的浪漫
zhi hao wei xiao zhu fu ni men de lang man

Chorus:
我終於變得不多愁善感
wo shi zhong bian de bu duo chou shan gan
回憶還像心跳那麼難忘
hui yi huan xiang xin tiao na me nan wang
擁抱的熱 還留在我們的身上
yong bao de re huan liu zai wo men de shen shang
緣分卻不能反抗
yuan fen que bu neng fan kang
愛人不變朋友實在太難
ai ren bu bian peng you shi zai tai nan
希望離別 能讓以後
xi wang li bie neng rang yi hou
更快樂 更幸福 更美滿
geng kuai le geng xing fu geng mei man

漫長路上你幫我背的行囊
man chang lu shang ni bang wo bei de xing nang
因為有你的汗 變成珍藏
yin wei you ni de han bian cheng zhen cang
我給你的補償 是為你打扮
wo gei ni de bu chang shi wei ni da ban

Repeat Chorus

那次大雨中下班
na ci da yu zhong xia ban
你拿一把雨傘 來接我
ni na yi ba yu san lai jie wo
想起來 難免傷感
xiang qi lai nan mian shang gan

感謝你愛我一場
gan xie ni ai wo yi chang
難得敘舊笑談
nan de xu jiu xiao tan
依然溫暖
yi ran wen nuan
有浪漫 沒緣分
you lang man mei yuan fen
總不算遺憾
zong bu suan yi han

我終於變得不多愁善感
wo zhong yu bian de bu duo chou shan gan
回憶還像心跳那麼難忘
hui yi huan xin tiao na me nan wang
擁抱的熱 還留在我們的身上
yong bao de re huan liu zai wo men de shen shang
緣分卻不能反抗
yuan fen que bu neng fan kang
愛人不變朋友實在太難
ai ren bu bian peng you shi zai tai nan
希望離別 能讓以後
xi wang li bie neng rang yi hou
更快樂 更幸福 更美滿
geng kuai le geng xing fu geng mei man
我快樂 的眼淚 在流轉
wo kuai le de yan lei zai liu zhuan

Sunday, September 3, 2017

Downloading Segmented Vimeo Videos

Have blogged about this before. Downloading Vimeo videos used to be a matter of clicking the download button that appears below the video player. Download disabled? No problem. Just plug in the Vimeo video URL to the many online video downloaders that supposedly can do the job. youtube-dl might even do the job.

Lately, I've noticed that a lot of the premium Vimeo videos are chopped up and sent to the client browser as m4s segments. I've written a blog post before re: downloading Brightcove videos, but this one is totally different. As far as I can tell, there is no main mp4 link that can be obtained. You'll have to save all these m4s segments and somehow piece them all together to get the complete video.

Did a bit of research, and looks like someone already wrote a python script that should be able to do this. Installation is pretty simple:

  1. Install additional requirements using pip install.
  2. Install ffmpeg.
  3. Extract the master URL (http://...master.json?base64_init=1) and plug into the vimeo-download command.

vimeo-download.py script should probably work fine with a Windows python and ffmpeg installation, but I decided to go with Linux. See my blog post about Linux VM. As mentioned, python comes pre-installed in Linux Mint, but not pip.

sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install python-pip

Once pip in installed, it's time to install the additional required packages:

pip install -r requirements.txt

Got an error message saying: ImportError: No module named setuptools

sudo pip install -U setuptools

Next error message is about OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/asn1crypto'

sudo pip install -r requirements.txt

Which now works fine until we get to:

build/temp.linux-x86_64-2.7/_openssl.c:12:24: fatal error: pyconfig.h: No such file or directory compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

This requires additional packages to be installed.

sudo apt-get install python-dev

Then we get: build/temp.linux-x86_64-2.7/_openssl.c:434:30: fatal error: openssl/opensslv.h: No such file or directory

sudo apt-get install build-essential libssl-dev libffi-dev

All the packages from requirements.txt were installed after these additional commands.

Next up is the ffmpeg installation. As instructed in the installation notes, tried to set mc3man/trusty-media as a PPA repository. Got the below error message, which indicates xenial (Linux Mint 18) is too new and not supported by the PPA.

This PPA does not support xenial

Why not just get ffmpeg from the official repositories? Which is what I did.

sudo apt-get install ffmpeg

Next question: How do we extract the master URL of a segmented vimeo video?

  1. Enable Developer Tools (Ctrl + Shift + I)
  2. Go to the Network tab.
  3. Play the Vimeo video.
  4. Look for the entry which says master.json?base64_init=1
  5. Right-click and Copy link address

Usage syntax is:
python vimeo-download.py --url "http://...master.json?base64_init=1" --output <optional_name>

From that master.json URL, we get the base video and audio URLs, and all the segments are retrieved. The v.mp4 video file and the a.mp3 audio file are muxed using ffmpeg to come up with the final vimeo video in the output directory.

Linux Virtual Machine

Sometimes, it's easier to get something done in Linux, compared to Windows. Yet, it might be a one-time job that doesn't warrant a special partition on the hard disk, or even a live CD-ROM or USB stick. For those time, you just want to run Linux on a virtual machine. You can delete the VM once you're done, or just keep VM file the run it again the next time you need it.

For desktop virtualization, it's a tossup between VMWare and Oracle's VirtualBox. Decided to go with the latter, since it's open-source and I feel easier to install and configure. Lots of pre-built images to choose from, but I decided to build the VM from scratch. It's just a matter of creating the VM and specifying the memory and hard disk space. On first boot, specify which Linux ISO to boot from and do a clean install.

Started off with Ubuntu Server, since I have no need for a GUI. For some reason, I was not able to install the VirtualBox guest additions. Tried:

sudo mkdir --p /media/cdrom
sudo mount -t auto /dev/cdrom /media/cdrom/
cd /media/cdrom/
sudo sh VBoxLinuxAdditions.run

and:

sudo apt-get install virtualbox-guest-utils

Seemed to do something, yet not able to get full-screen window and cut-and-paste between host and guest, so I guess it didn't work.

Moved on to Lubuntu. Window resolution was so low that the installation screens are cropped out. Managed to get the OS installation going. Again, had a hard time getting the guest additions working, even though I got the Guest Additions CD image mounted.

Lastly, I tried Linux Mint 18. With this, everything just worked. No cropped installation screens. Full-screen window *before* I installed guest additions. And now I can open multiple terminals, do cut-and-paste between host and guest, and shared folders. Bonus points - python comes pre-installed (but not pip).

Tuesday, August 29, 2017

張惠妹 - 如果你也聽說

張惠妹 - 如果你也聽說

作詞:李焯雄
作曲:周杰倫
編曲:吳慶隆

伴奏版



突然發現站了好久 不知道要往哪走
tu ran fa xian zhan le hao jiu bu zhi dao yao wang na zou
還不想回家的我 再多人陪只會更寂寞
hai bu xiang hui jia de wo zai duo ren pei zhi hui geng ji mo
許多話題關於我 就連我也有聽過
xu duo hua ti guan yu wo jiu lian wo ye you ting guo
我的快樂要被認可 委屈卻沒有人訴說
wo de kuai le yao bei ren ke wei qu que mei you ren su shuo

夜把心洋蔥般剝落 拿掉防衛剩下什麼
ye ba xin yang cong ban bo luo na diao fang wei sheng shen me
為什麼脆弱時候想你更多
wei shen me cui ruo shi hou xiang ni geng duo

Chrous:
如果你也聽說 有沒有想過我
ru guo ni ye ting shuo you mei you xiang guo wo
像普通 舊朋友 還是你 依然會心疼我
xiang pu tong jiu peng you hai shi ni yi ran hui xin teng wo
好多好多的話想對你說 懸著一顆心沒著落
hao duo hao duo de hua xiang dui ni shuo xuan zhe yi ke xin mei zhao luo
要怎麼負荷 捨不得又無可奈何
yao zen me fu he she bu de you wu ke nai he

如果你也聽說 會不會相信我
ru guo ni ye ting shuo hui bu hui xiang xin wo
對流言 會附和 還是你 知道我還是我
dui liu yan fu he hai shi ni zhi dao wo hai shi wo
跌跌撞撞才明白了許多 懂我的人就你一個
die die zhuang zhuang le cai ming bai le xiu duo dong wo de ren jiu ni yi ge
想到你想起我 胸口依然溫熱
xiang dao ni xiang qi wo xiong kou yi ran wen re

許多話題關於我 就連我也有聽過
xu duo hua ti guan yu wo jiu lian wo ye you ting guo
我想我寧可都沉默 解釋反而顯得做作
wo xiang wo ning ke du chen mo jie shi fan er xian de zuo zuo

夜把心 洋蔥般剝落 拿掉防衛剩下什麼
ye ba xin yang cong ban bo luo na diao fang wei sheng xia shen me
為什麼脆弱時候想你更多
wei shen me cui ruo shi hou xiang ni geng duo

Repeat Chorus

如果你也聽說 有沒有想過我
ru guo ni ye ting shuo you mei you xiang guo wo
像普通 舊朋友 還是你 依然會心疼我
xiang pu tong peng you hai shi ni yi ran hui xin teng wo
跌跌撞撞才明白了許多 懂我的人就你一個
die die zhuang zhuang cai ming bai le xiu duo dong wo de ren jiu ni yi ge
想到你想起我 胸口依然溫熱
xiang dao ni xiang qi wo xiong kou yi ran wen re
如果你想起我 你會想到什麼
ru guo ni xiang qi wo ni hui xiang dao shen me

Friday, August 11, 2017

Lego Island on Windows 10

It's always tricky running old-school 90's PC games with modern operating systems like Windows 10. I got hold of an ISO of Lego Island. Mounted it via Windows Explorer and proceeded to install the game. Wanted to install DirectX 5. What?! Windows 10 offered to install DirectPlay. Installed but the game still won't run.

Lucky for me, someone else ran into the same problem, and figured out a workaround.

  1. Install the game as you normally would.
  2. Do NOT install DirectX when asked by the installer.
  3. Copy the contents of Lego/Scripts folder from the CD-ROM to the corresponding folder on the hard disk.
  4. From the redist/directx folder of the CD-ROM, copy d3drm.dll file to the main folder of the game.
  5. For best results, enable "Run as administrator" and "Compatibility mode (WindowsXP SP3)" for LEGOISLE.EXE and ISLE.EXE.
  6. Also, run CONFIG.EXE and select Ramp Emulation under Advanced settings.
  7. Enable "Draw 3D to Video Memory" and "Flip Video Pages Memory".


Or we can just do it the easy way. Load the CD-ROM (or ISO), then run the alternate installer created by le717 (Caleb Ely), which can be found here.

Saturday, July 29, 2017

SyncToy with Network Drives

Wanted to synchronize a local directory with one on the network drive. Fired up Microsoft's SyncToy to do the job. For some reason, SyncToy is not able to see the network folder mapped to a local drive letter.

Solution? Use the UNC path instead. Not sure what's the UNC path for your mapped drive? Run "net use" on the command prompt.

Friday, June 30, 2017

Windows 10 Screensaver

Every time I reinstall Windows, I register additional user accounts, configure the default apps, adjust the power settings, the mouse pointer speed, and enable the screensaver. Lately, with Windows 10, I always spend a disproportionate amount of time looking for the screensaver settings.

You'd think it'll be under Display, but it's not. Entering "screen" or "screen saver" in the Settings search box doesn't give any relevant results either. It's like Microsoft doesn't want people to use screensavers in this day and age anymore. But it is there - you just need to know where to look.

Under Personalization, go to Lock screen. Right at the bottom, you'll find "Screen saver settings". You're welcome.

Thursday, June 22, 2017

Internet Speed Test

Quick, how fast is your Internet connection? Speedtest.net! I mean, everybody and their dog knows about speedtest.net. Kudos to Ookla's marketing department. The good thing about speedtest.net is that they work with around 6,000 servers in over 200 countries and regions, which makes the test results quite accurate, as you're always testing with a "local" server. On the flip side, speedtest.net usage has become so prevalent that quite a few carriers and ISPs have started "optimizing" traffic to/from Ookla's servers. This gives an excellent speed rating, and customers are happy. Win-win!

Did you know there are other (better?) alternatives out there? Why not try Big G's own speed test? Just type in, you guessed it, speed test on the Google search bar, and away you go. Service is provided by Measurement Lab (M-Lab). You can also try fast.com, which is powered by Netflix. Fast.com only measures download speed though. If you like real-time graphs and pie charts, give speedof.me a try. It measure upload speed, download speed, and latency. Download speed is calculated over 9 passes with different file sizes.

Something Stupid (CSE Revue Version)

Something Stupid
(from UNSW CSE Revue 2004)

You had to stand in line
Because I lost the track of time
And you just waited for me

I fumbled as we tried to dance
I spilt wine on your pants
But you're still patient with me

Then afterwards I dropped into a quiet Liquorland
And had a case or two

I screwed it up once and for all
By saying something stupid
Like "If you and your sister were both really drunk..."

Then I try to apologise
But I mention you've got fat thighs
And screw it up some more

I wish I could explain to you
Although it's true
I shouldn't point out no more

I try to everyday come up with nicer things to say
But I'd rather be honest with you
Remember our first date, I tried to guess your body weight
And I said 152

And now tonight
The vodka fill my head
My eyes turn red
And walk up to you
and I screw it up once and for all
By saying something stupid
Like "You know... For a girl her age, I always thought Penny from Inspector Gadget was pretty hot"

Later that night
I get to clear my head
And say instead
That out of five, she's two
And then I go fix it all
By saying something simple
Like I love you
I love you
I love you
I love you
I love you
Girl: I'm pregnant
Guy: Shithouse


Walking on Landmines (CSE Revue Version)

Walking on Landmines
(from UNSW CSE Revue 2004)

I used to farm grain in my village
But not anymore
Yes everything changed on that day
When you came to my shore

You were looking for some guy named Charlie
I tried to help out
But all I could find was a Claymore
Whilst walking about

I was walking on landmines (woah!)
I was walking on landmines (wo-oah!)
I was walking on landmines (wo-oah!)
And it didn't Feel Good (Hey) (All right now)
And it didn't Feel Good (Hey) (Yeah)

So there I was in a hospital
Just waiting for aid
You'll never believe it the doctor
Was killed by a grenade

Now I'm not gonna heal in a weekend
Nor heal in a day
Oh man I'd trade an arm and a leg
for a ... shit!

I was walking on landmines (woah!)
I was walking on landmines (wo-oah!)
I was walking on landmines (wo-oah!)
And it didn't Feel Good

Wednesday, June 21, 2017

Cyberian Rhapsody (CSE Revue Version)

Cyberian Rhapsody
(from UNSW CSE Revue 2004)

Don't like my real life, I just want fantasy
Log on a chat line, to escape from reality
Tell a few lies, to hide my identity
My nick is Toyb0i, when I am on IRC
And now I'm logging on ICQ, MSN, and Yahoo
I'm a cyber-sex pro, someone send a message to me
To me

Mama, despite your ban
Looked up porno on the web
Masturbated in my bed
Mama, I had just begun
When you walked into my room then stormed away
Mama, ooo,
There's no love in real life
So I'll log on again this time tomorrow
Logging on, logging on, it is all that really matters...

Today, I met someone
She sent shivers down my spine
Her display pic looks so fine
Tell me everybody, I've got to know
Should I tell some lies or should I tell the truth
Mama ooo- (don't mention your webbed toes)
I don't want to lie,
But if I don't I'll never find love at all...

I emailed her a picture of another man
Nice round tush, and good looks, oh what a killer combo
Handsome like prince charming, like the guy from Titanic
Leonardo, Leonardo
Leonardo, Leonardo
Leonardo, what's his name? Dicaprio

A/S/L baby, are you from Sydney?
No, I'm from Perth, but I'm flying there quickly
If you have would you like to meet me...
I'm in love, I will go, please mum let me go
to see her no I will not let you go *LET ME GO*
to see her no I will not let you go *LET ME GO*
to see her no I will not let you go *LET ME GO*
Will not let you go *LET ME GO* will not let you go *LET ME GO*
Never never let me goooo no no no no no no no
Oh can I meet her, let me meet her, if I meet her will she know?
I wonder if she has lied about herself like me, like me, like me

So I met her and I could not believe my eyes
Her bra size was not D it was A she had lied
and ninety... it turned out she was ninety
And then I found out, and then I found out 'bout her beard

oooh yes oooh yes oooh

Love life's all in tatters
and girls are not for me
But if I am a homo, at least the odds are good at CSE

Are there any homos...?

Saturday, June 17, 2017

Password-Protected Notes

Depends on the application really. For account information, your best bet would be KeePass, which has password protection and encryption built in. There are standard fields for username, password, URL, etc. and a section for notes and comments.

Microsoft Word has password protection for documents, but is a bit of overkill if all you want is a notepad for plain text.

Best solution I've found so far is SecurePad plugin for Notepad++. Open-source and works as advertised. You can choose to encrypt the whole document or just the selected text. Once encrypted, the document or the selected text becomes unreadable until it's decrypted with the correct password.

Friday, June 16, 2017

周杰倫 - 龍捲風

周杰倫 - 龍捲風

作詞:徐若瑄
作曲:周杰倫
編曲:鍾興民



愛像一陣風 吹完它就走
ai xiang yi zhen feng / chui wan ta jiu zou
這樣的節奏 誰都無可奈何
zhe yang de jie zou / shui dou wu ke nai he
沒有妳以後 我靈魂失控
mei you ni yi hou / wo ling hun shi kong
黑雲在降落 我被它拖著走
hei yun zai jiang luo / wo bei ta tuo zhe zou

Bridge
靜靜悄悄默默離開
jing jing qiao qiao mo mo li kai
陷入了危險邊緣 Baby
xian ru le wei xian bian yuan baby
我的世界已狂風暴雨
wo de shi jie yi kuang feng bao yu

Chorus
愛情來的太快就像龍捲風
ai qing lai de tai kai jiu xiang long juan feng
離不開暴風圈 來不及逃
li bu kai bao feng quan / lai bu ji tao
我不能再想 我不能再想
wo bu neng zai xiang / wo bu neng zai xiang
我不 我不 我不能
wo bu / wo bu / wo bu neng

愛情走的太快就像龍捲風
ai qing zou de tai kuai, jiu xiang long juan feng
不能承受 我已無處可躲
bu neng cheng shou / wo yi wu chu ke duo
我不要再想 我不要再想
wo bu yao zai xiang / wo bu yao zai xiang
我不 我不 我不要再想你
wo bu / wo bu / wo bu yao zai xiang ni

不知不覺 你已經離開我
bu zhi bu jue / ni yi jing li kai wo
不知不覺 我跟了這節奏
bu zhi bu jue / wo gen le zhe jie zou
後知後覺 又過了一個秋
hou zhi hou jue / you guo le yi ge qiu
後知後覺 我該好好生活
hou zhi huo jue / wo gai hao hao sheng huo

Repeat Bridge

Repeat Chorus

(間奏)

Repeat Chorus

不知不覺 你已經離開我
bu zhi bu jue / ni yi jing li kai wo
不知不覺 我跟了這節奏
bu zhi bu jue / wo gen le zhe jie zou
後知後覺 又過了一個秋
hou zhi hou jue / you guo le yi ge qiu
後知後覺 我該好好生活
hou zhi huo jue / wo gai hao hao sheng huo

不知不覺 你已經離開我
bu zhi bu jue / ni yi jing li kai wo
不知不覺 我跟了這節奏
bu zhi bu jue / wo gen le zhe jie zou
後知後覺 又過了一個秋
hou zhi hou jue / you guo le yi ge qiu
後知後覺 我該好好生活
hou zhi huo jue / wo gai hao hao sheng huo

不知不覺 你已經離開我
bu zhi bu jue / ni yi jing li kai wo
不知不覺 我跟了這節奏
bu zhi bu jue / wo gen le zhe jie zou
後知後覺 後知後覺

hou zhi huo jue / hou zhi huo jue

周杰倫 - 黑色幽默

周杰倫 - 黑色幽默

作詞:周杰倫
作曲:周杰倫



難過 是因為悶了很久
nan guo / shi yin wei men le hen jiu
是因為想了太多 是心理起了作用
shi yin wei xiang le tai duo / shi xin li qi le zuo yong
你說 苦笑常常陪著你
ni shuo / ku xiao chang chang pei zhe ni
在一起有點勉強 該不該現在休了我
zai yi qi you dian mian qiang / gai bu gai xian zai xiu le wo

*
不想太多
bu xiang tai duo
我想一定是我聽錯弄錯搞錯
wo xiang yi ding shi wo ting cuo nong cuo gao cuo
拜託 我想是你的腦袋有問題
bai tuo / wo xiang shi ni de nao dai you wen ti
隨便說說
sui bian shuo shuo
其實我早己經猜透看透不想多說
qi shi wo zao yi jing cai tou kan tou bu xiang duo shuo
只是我怕眼淚撐不住
zhi shi wo pa yan lei cheng bu zhu

不懂 你的黑色幽默
bu dong / ni de hei se you mo
想通 卻又再考倒我
xiang tong / que you zai kao dao wo
說散 你想很久了吧
shuo san / ni xiang hen jiu le ba
我不想拆穿你
wo bu xiang chai chuan ni

當作 是你開的玩笑
dang zuo / shi ni kai de wan xiao
想通 卻又再考倒我
xiang tong / que you zai kao dao wo
說散 你想很久了吧
shuo san / ni xiang hen jiu le ba
敗給你的黑色幽默
bai gei ni de hei se you mo

Repeat from *

說散 你想很久了吧
shuo san / ni xiang hen jiu le ba
我的認真敗給黑色幽默

wo de ren zhen bai gei hei se you mo

周杰倫 - 時光機

周杰倫 - 時光機

作詞:方文山
作曲:周杰倫



Verse 1:
牆角迎風的雛菊
qiáng jiǎo yíng fēng dì chú jú
茉莉花開的香氣
mò lì huā kāi de xiāng qì
閉上眼回到過去
bì shàng yǎn huí dào guò qù

劃分界線的桌椅
huà fēn jiè xiàn de zuò yǐ
下課卻靠在一起
xià kè què kào zài yī qǐ
我就是離不開妳
wǒ jiù shì lí bù kāi nǐ

一路乘著溜滑梯
yī lù chéng zhe liū huá tī
我們說好走到底
wǒ men shuō hǎo zǒu dào dǐ
以為從此就分離
yǐ wei cóng cǐ jiù fēn lí
用黑板上的日期
yòng hēi bǎn shàng de rì qī
倒数找你
dào shǔ zhǎo nǐt

慢慢清晰
màn màn qīng xī
原來思念妳是加了糖的消息
yuán lái sī niàn nǐ shì jiā le táng de xiāo xī
我用鉛筆
wǒ yòng qiān bǐ
畫的很仔細素描那年天氣
huà de hén zǐ xì sù miáo nà niān tiān qì
蟬鳴的夏季 我想遇見妳
cán mǐng de xià jì wǒ xiǎng yù jiàn nǐ

Chorus:
那童年的希望是一台時光機
nà tóng nián de xī wàng shì yī tái shí guāng jī
我可以一路開心到底 都不換氣
wǒ kě yǐ yī lù kāi xīn dào dǐ dōu bù huàn qì
戴竹蜻蜓 穿過那森林
dài zhú qīng tíng chuān guò nà sēn lín
打開了任意門找到妳 一起旅行
dǎ kāi le rèn yì mén zhǎo dào nǐ yī qǐ lǚ xíng

那童年的希望是一台時光機
nà tóng nián de xī wàng shì yī tái shí guāng jī
妳我翻滾過的榻榻米 味道熟悉
nǐ wǒ fān gǔn guò de tà tà mǐ wèi dào shú xī
所有回憶 在小叮噹口袋裡
suǒ yǒu huí yì zài xiǎo dīng dāng kǒu dài lǐ
一起盪鞦韆的默契
yī qǐ dàng qiū qiān de mò qì
在風中持續著甜蜜
zài fēng zhōng chí xù zhe tián mì

Verse 2:
有些話總來不及
yǒu xiē huà zóng lái bù jí
一直都放在心底
yī zhí dōu fàng zài xīn dǐ
想要將妳看仔細
xiǎng yào jiāng nǐ kàn zǐ xì

但錯身而過的妳
dàn cuò shēn ér guò de nǐ
已經離去
yǐ jīng lí qù

慢慢清晰
màn màn qīng xī
原來思念妳是加了糖的消息
yuán lái sī niàn nǐ shì jiā le táng de xiāo xī
我用鉛筆
wǒ yòng qiān bǐ
畫的很仔細素描那年天氣
huà de hén zǐ xì sù miáo nà niān tiān qì
蟬鳴的夏季 我想遇見妳
cán mǐng de xià jì wǒ xiǎng yù jiàn nǐ

Repeat Chorus 2x

持續著甜蜜 (x3)

chí xù zhe tián mì