Skip to content

Instantly share code, notes, and snippets.

@Kennyl
Kennyl / emoji_clock.sh
Last active November 25, 2017 05:19
shell script emoji clock for current time one o'clock stand for 00:45 to 01:14 etc...
printf -v clock "%d" `expr $(date +%H%M) % 1200`
oclock=🕛
[ ${clock} -gt 14 ] && oclock=🕧
[ ${clock} -gt 44 ] && oclock=🕐
[ ${clock} -gt 114 ] && oclock=🕜
[ ${clock} -gt 144 ] && oclock=🕑
[ ${clock} -gt 214 ] && oclock=🕝
[ ${clock} -gt 244 ] && oclock=🕒
@Kennyl
Kennyl / tts.js
Last active October 30, 2017 03:26
SpeechSynthesisUtterance Example for HTML
// <script src="tts.js"></script> embed in html
// tts_content_tag_id is the ElementID that to be read
// tts_lang is lang of speak
// tts_icon_in_tagname (h1) where is tts icon to place with
// yue is zh-HK
// Mandarin is zh
var tts_content_tag_id = '_tl_editor';
var tts_lang = 'zh-HK';
@Kennyl
Kennyl / ! Python FontForge Scripts ReadMe .MD
Last active October 30, 2017 05:46
Python Scripts that using FontForge module

Obsoleted please refer to here for New Scripts

Please install python-fontforge module first

Python script that minimize ttf font by input word list

Use minifyTC as input word list

@Kennyl
Kennyl / ! FontForge Script .md
Last active December 19, 2021 01:35
FontForge Script !!! Good for Epub, TTF reduce, Traditional Chinese adapt Simplified Chinese

Obsoleted please refer to here for New Scripts

Center All Chinese Punctuations

A simple word list test file, only one to one case, no one to many case

A Word list there is simple different from TC and SC, only one to one case, no one to many case

@Kennyl
Kennyl / Calc_AutoFill_Example.bas
Last active October 5, 2021 04:22
LibreOffice Calc Macro Basic Script
''' Basic Script for Libre Office Calc , Demo AutoFill
Sub AutoFill
Sheets = ThisComponent.getSheets()
oSheet = Sheets.getByName("MemberList")
oRange = oSheet.getCellRangeByName("A2:A6") ' A4:A6 has no data
oRange.fillAuto(com.sun.star.sheet.FillDirection.TO_BOTTOM,1)
End Sub
@Kennyl
Kennyl / android.sh
Last active September 24, 2017 06:08
Android Adb Shell
/adb shell screenrecord --help
Android screenrecord v1.2. Records the device's display to a .mp4 file.
Options:
--size WIDTHxHEIGHT
Set the video size, e.g. "1280x720". Default is the device's main
display resolution (if supported), 1280x720 if not. For best results,
use a size supported by the AVC encoder.
--bit-rate RATE
@Kennyl
Kennyl / a.js
Last active April 22, 2017 03:24
fontmin reduce
var fs = require("fs");
var Fontmin = require('fontmin');
var content = fs.readFileSync('a.txt', 'utf8');
var fontmin = new Fontmin()
.src('a.ttf')
.use(Fontmin.glyph({
text: content,
hinting: false // keep ttf hint info (fpgm, prep, cvt). default = true
@Kennyl
Kennyl / 行車速度屏.MD
Last active April 19, 2017 10:39
行車速度屏

行車速度屏 - 大埔道沙田段南行近馬場(繁體中文) http://resource.data.one.gov.hk/td/TIS_S1_TC.png

行車速度屏 - 大老山隧道南行近石門(繁體中文) http://resource.data.one.gov.hk/td/TIS_S2_TC.png

行車速度屏 - 吐露港公路南行近科學園(繁體中文) http://resource.data.one.gov.hk/td/TIS_S3_TC.png

@Kennyl
Kennyl / fixSEPermission.sh
Created March 12, 2017 11:03
WordPress SELinux
sudo chcon -R -v -t httpd_sys_content_t www/
sudo chcon -R -v -t httpd_sys_rw_content_t www/wp-content/plugins/ www/wp-content/themes/ www/wp-content/upgrade/ www/wp-content/uploads/
@Kennyl
Kennyl / mount-ntfs.md
Last active March 10, 2017 15:04
How to mount NTFS on MacOS Serria

Preparation

brew install Caskroom/cask/osxfuse
brew install ntfs-3g

Serria is now rootless, so we need to disable rootless csrutil disable or reboot in recovery mode