Skip to content

Instantly share code, notes, and snippets.


Edward Tsang eplt

View GitHub Profile
eplt /
Last active May 29, 2022 04:26
Install Imagemagick with HEIC on DigitalOcean LAMP Ubuntu 20.04
start_time="$(date -u +%s)"
sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
apt-get update
apt-get -y install build-essential autoconf libtool git-core
apt-get -y build-dep imagemagick libmagickcore-dev libde265 libheif
cd /usr/src/
git clone
git clone
cd libde265/
eplt / telegrambot.txt
Created September 21, 2020 11:10
To create a Telegram Bot
View telegrambot.txt
Step 1: Get a bot id and keys
Add botfather to your telegram account. Follow the interactive mode to choose the id, and you will get key (sample below, use your own key!).
Done! Congratulations on your new bot. You will find it at You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
Use this token to access the HTTP API:
Keep your token secure and store it safely, it can be used by anyone to control your bot.
View Fabric_Network_3_Peers.txt
║ Node ║ Zookeeper ║ Kafka ║ Orderer ║ Peer ║ Cli ║
║ 1 ║ zookeeper0 ║ kafka0 kafka1 ║ orderer0 ║ ║ cli0 ║
║ 2 ║ ║ ║ ║ ║ cli1 ║
║ 3 ║ ║ ║ ║ ║ cli2 ║
eplt / ubuntu-do.txt
Last active May 28, 2022 11:12
Ubuntu Cheatsheet - Commonly used commands for Ubuntu (18.04 and 20.04) on DigitalOcean
View ubuntu-do.txt
I use Ubuntu 18.04 Droplet on DigitalOcean often, this is a cheatlist of commands that I use often.
Use my link (Discount code for newbies, I get some free referral credits too) to sign up and start playing.
--- Check your OS version
cat /etc/os-release
--- DigitalOcean Ubuntu 14.04 do-agent (monitoring) install
curl -L -o ./
sed -i '17s/https/http/'
chmod 775
eplt / exifupdate.txt
Last active October 6, 2021 03:21
Update EXIF for Flickr uploading
View exifupdate.txt
-- Before uploading photos to Flickr, I use the following command to update copyright notice of all my images with EXIFTOOL
exiftool -r -m -P -overwrite_original_in_place -artist="OnDemandWorld 点应科技" -copyright="2009-2021 OnDemandWorld" -usercomment="Copyright © 2009-2021 OnDemandWorld 点应科技" <Path>
eplt / macOS.txt
Last active April 25, 2022 06:59
macOS Cheatsheet - Commonly used commands for my macOS Setup
View macOS.txt
-- Automate your macOS a bit more, schedule Safari to open your favourite sites regularly at 7am to save a few seconds each morning.
# In terminal, type the following command which will allow you to edit current scheduled jobs with nano editor
# You might need to grant cron full disk access for this to work.
env EDITOR=nano crontab -e
# Then copy and paste the following lines. Control-X to exit nano. The new jobs will be schedulled.
# The samples below are to open Safari at 7am each morning with the specified URL. It should placed them in new tab if that's how your safari is setup. It's good to wake up each morning saving a few seconds loading the sites you read daily. You can also use similar schedule to download files, open apps, etc. To learn more about how to specify the time, check out
$ crontab -r where the -r flag removes current crontab configuration.
eplt / pdfcoverpage.txt
Last active October 6, 2021 03:22
Extract and Combine First Page of each PDF in folder - OS X, requires GS or PDFTK
View pdfcoverpage.txt
echo "Start Script"
rm combined.pdf
for file in *.pdf ; do pdftk "$file" cat 1 output "${file%.pdf}-page1.pdf" ; done
pdftk *-page1.pdf cat output combined.pdf
#for file in *.pdf ; do gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="${file%.pdf}-page1.pdf" -dFirstPage=1 -dLastPage=1 "$file" ; done
#gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE#pdfwrite -sOutputFile#"combined.pdf" *-page1.pdf
# `` downloads Apple iOS App Store sales data. It will
# download it to the same folder the script is running from, and group
# the downloaded files into directories by report type.
# It will only attempt to download if new sales data should be
# available.
# As skipping already downloaded files depends on the filename pattern
eplt / OSX Switch TTS Language
Last active August 29, 2015 13:57
An AppleScript to switch the Text-To-Speech voice from Daniel to Ting-Ting and vice versa. I use it because I often have to switch between English and Chinese TTS. I found this script online and modified it.
View OSX Switch TTS Language
tell application "System Preferences"
reveal anchor "TTS" of pane ""
end tell
tell application "System Events" to tell process "System Preferences"
tell pop up button 1 of tab group 1 of window 1
delay 0.5 -- without this the value was sometimes "Loading Voices…"
if value is "Daniel" then
click menu item "Ting-Ting" of menu 1