Skip to content

Instantly share code, notes, and snippets.

@lacek
lacek / README.md
Created Nov 27, 2020
MySQL InnoDB Cluster on Docker
View README.md

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
lacek / gdown.sh
Created Apr 27, 2020
Shell script for Google Drive download
View gdown.sh
#!/bin/sh
FILE_ID=$1
DEST=$2
if [ -z "$FILE_ID" -o -z "$DEST" ]; then
>2 echo "USAGE: sh $0 <FILE_ID> <DEST>"
exit 1
fi
cookie=$(mktemp -ut gdown.XXXXXX)
@lacek
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._super(...arguments);
this.set('items', [
'Adenosine',
'Cytosine',
'Guanine',
'Thymidine',
@lacek
lacek / upgrade_mysql_55_to_57_in_docker.md
Created Jan 14, 2020
Experiment on upgrading MySQL 5.5 to 5.7 in Docker
View upgrade_mysql_55_to_57_in_docker.md

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
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)`);
View README.md
# installed Docker CE 18.09.7 on Ubuntu 18.04
sudo curl -fsSLo /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.4.0/kind-linux-amd64
sudo chmod +x /usr/local/bin/kind
docker pull kindest/node:v1.13.7
cat <<EOF > kind-config.yaml
kind: Cluster
# see https://godoc.org/sigs.k8s.io/kind/pkg/apis/config/v1alpha3#Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
@lacek
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
lacek / kdc-offline.md
Created Jul 11, 2019
Offline dind-cluster.sh
View kdc-offline.md

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)

@lacek
lacek / convert_cookies.py
Created Apr 11, 2019
Converts cookie JSON exported from EditThisCookie to formats for wget/curl
View convert_cookies.py
#!/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')