Skip to content

Instantly share code, notes, and snippets.

VoiceOver Bug Report

Description

VoiceOver in Cantonese is unable to speak the pattern /百分之[0-9]+/, i.e. Chinese percentage, e.g. "百分之10", "百分之20", "百分之1000", etc.

Procedures to reproduce

  1. Change Language to 繁體中文 (Traditional Chiense)
@lacek
lacek / Spring JNDI Data Source.md
Last active August 29, 2015 14:24
Specify data source using JNDI resource in Spring

Setting:

  • Ubuntu 14
  • Tomcat 7
  • Spring 3
  • MySQL 5.6

Install JDBC connector

#!/usr/bin/env python
import gevent
from gevent.threadpool import ThreadPool
from random import randint
def worker(id):
print('worker %d working...' % (id))
time = randint(1, 5)
gevent.sleep(time)
Windows Registry Editor Version 5.00
; Solarized Dark Color Scheme for PuTTY
; https://github.com/altercation/solarized/tree/master/putty-colors-solarized
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Default%20Settings]
"Colour0"="131,148,150"
"Colour1"="147,161,161"
"Colour2"="0,43,54"
"Colour3"="7,54,66"
@lacek
lacek / csv_line.sh
Last active October 31, 2017 03:15
#!/bin/bash
show_help()
{
cat <<EOB
Usage: ${0##*/} [-h] [-t sep] [-n num] file
Display a row in CSV file with header vertially.
Options:
-t specify field separator, default is tab
-n specify line to show, default is 1

Convert MP4 to WMV on MacOS

Install ffmpeg

  1. Open Spotlight:

    Open Spotlight

  2. Search Terminal and press enter:

@lacek
lacek / mp_queue.py
Last active August 23, 2018 02:59
Pythhon multiprocessing with queue
#!/usr/bin/env python2.7
# single producer-multiple consumer parallelism using a queue
from ctypes import c_bool
import logging
import multiprocessing as mp
import time
TASK_END = 'TASK_END'
NUM_CONSUMERS = 2
NUM_TASKS = 4
@lacek
lacek / update-jenkins.sh
Created August 23, 2015 14:36
Update Jenkins on Mac OS X
#!/bin/bash
DEFAULT_URL=http://updates.jenkins-ci.org/current/latest/jenkins.war
TMP_PATH=/tmp/jenkins.war
APP_PATH=/Applications/Jenkins/jenkins.war
PLIST_PATH=/Library/LaunchDaemons/org.jenkins-ci.plist
url=${1-$DEFAULT_URL}
echo 'Downloading WAR package...'
@lacek
lacek / .screenrc-main-example
Last active December 11, 2018 07:07 — forked from ChrisWills/.screenrc-main-example
A nice default screenrc
# GNU Screen - main configuration file
# All other .screenrc files will source this file to inherit settings.
# Author: Christian Wills - cwills.sys@gmail.com
# Allow bold colors - necessary for some reason
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
@lacek
lacek / kdc-offline.md
Created July 11, 2019 03:19
Offline dind-cluster.sh

Background

The installation kubeadm-dind-cluster requires Internet, because both the script itself and kubeadm inside pulls Docker images from Docker Hub and Google Container Registry.

One way to avoid the Internet requirement is to host a local Docker registry preloaded with all images required and configure the cluster to pull from this local registry.

The setup below demonstration air gap installation of Kubernetes v1.13, tested with Ubuntu 18.04 and Docker CE 18.09.6.

Preparation (Internet required)