Skip to content

Instantly share code, notes, and snippets.

lacek /
Created Nov 27, 2020
MySQL InnoDB Cluster on Docker

Testing MySQL InnoDB Cluster with Docker

  1. Spin up the cluster
docker-compose up -d
docker-compose exec mysql1 mysqlsh -f /init.js
  1. Test access to the cluster
View components.custom-trigger\.js
import TriggerComponent from 'ember-power-select/components/power-select-multiple/trigger';
const isTouchDevice = !!window && 'ontouchstart' in window;
export default TriggerComponent.extend({
layoutName: 'components/trigger',
didInsertElement() {
let select = this.get('select');
this.input = document.getElementById(`ember-power-select-trigger-multiple-input-${select.uniqueId}`);
lacek /
Created Apr 27, 2020
Shell script for Google Drive download
if [ -z "$FILE_ID" -o -z "$DEST" ]; then
>2 echo "USAGE: sh $0 <FILE_ID> <DEST>"
exit 1
cookie=$(mktemp -ut gdown.XXXXXX)
lacek / controllers.application\.js
Last active Mar 20, 2020
ember-sortable animation glitch
View controllers.application\.js
import Controller from '@ember/controller';
export default Controller.extend({
init() {
this.set('items', [
lacek /
Created Jan 14, 2020
Experiment on upgrading MySQL 5.5 to 5.7 in Docker

Trial of Upgrading MySQL 5.5 to 5.7 in Docker

  1. Start a MySQL 5.5 and load data
    docker run -d --rm --name db55 \
        -v $PWD/my_db:/var/lib/mysql \
        -e 'MYSQL_ROOT_HOST=%' \
        -e 'MYSQL_ROOT_PASSWORD=root' \
        -e 'MYSQL_DATABASE=my_db' \
        -p 8306:3306 mysql:5.5
lacek / components.grid-value.js
Created Dec 31, 2019
Ember Bootstrap Tooltip
View components.grid-value.js
import Ember from 'ember';
import { computed } from '@ember/object';
export default Ember.Component.extend({
classNames: 'grid-value',
attributeBindings: ['style'],
value: 0,
style: computed('value', function() {
let value = this.get('value');
return Ember.String.htmlSafe(`background-color: rgb(${value}, 0, 0)`);
# installed Docker CE 18.09.7 on Ubuntu 18.04
sudo curl -fsSLo /usr/local/bin/kind
sudo chmod +x /usr/local/bin/kind
docker pull kindest/node:v1.13.7
cat <<EOF > kind-config.yaml
kind: Cluster
# see
lacek / Dockerfile
Created Jul 15, 2019
Nvidia Docker in Docker
View Dockerfile
FROM nvidia/cuda:10.1-base-ubuntu18.04
RUN sed -i -E -e 's@//(archive|security).ubuntu@//hk.archive.ubuntu@' /etc/apt/sources.list \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
iptables \
lacek /
Created Jul 11, 2019


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)

lacek /
Created Apr 11, 2019
Converts cookie JSON exported from EditThisCookie to formats for wget/curl
#!/usr/bin/env python2.7
from __future__ import print_function
import argparse
import json
import sys
parser = argparse.ArgumentParser(
description='Converts cookie JSON exported from EditThisCookie to formats for wget/curl')
parser.add_argument('-f', '--format', choices=('netscape', 'curl',),
default='netscape', help='Output format')