Skip to content

Instantly share code, notes, and snippets.

@lacek
lacek / custom_keys_git_ssh
Created October 27, 2023 07:16 — forked from vhermecz/custom_keys_git_ssh
Allow configuring multiple ssh deploy keys with git
#!/bin/bash
# Script to use custom ssh keys for various git repositories
# Run without arguments to get usage info.
#
# How it works:
# When used with SSH, git sends the path to the repository in the SSH command.
# @see: https://github.com/git/git/blob/e870325/connect.c#L1268
# We extract this info and search for a key with the name.
# Based on the source, this seems to be used format since v2.0 at least.
# @see: https://github.com/git/git/commit/a2036d7
@lacek
lacek / README.md
Created November 27, 2020 10:28
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
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 April 27, 2020 13:31
Shell script for Google Drive download
#!/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 March 20, 2020 08:11
ember-sortable animation glitch
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 January 14, 2020 02:44
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
lacek / components.grid-value.js
Created December 31, 2019 10:06
Ember Bootstrap Tooltip
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 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 July 15, 2019 04:21
Nvidia Docker in Docker
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 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)