Skip to content

Instantly share code, notes, and snippets.

@ShX
ShX / 0-create-and-import.sh
Last active August 23, 2018 14:13
Mysql container
#!/usr/bin/env bash
run() {
for DB in `find /docker-entrypoint-initdb.d/ -mindepth 1 -maxdepth 1 -type d -printf '%P\n'`; do
echo "Create $DB"
mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "CREATE DATABASE IF NOT EXISTS $DB"
mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "GRANT ALL ON *.* TO '${MYSQL_USER}'@'%'"
mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e "FLUSH PRIVILEGES"
for DUMP in `find /docker-entrypoint-initdb.d/${DB}/ -mindepth 1 -name '*.sql' -printf '%P\n'`; do
@ShX
ShX / AWS Swarm cluster.md
Created September 8, 2017 11:40 — forked from ghoranyi/AWS Swarm cluster.md
Create a Docker 1.12 Swarm cluster on AWS

This gist will drive you through creating a Docker 1.12 Swarm cluster (with Swarm mode) on AWS infrastructure.

Prerequisites

You need a few things already prepared in order to get started. You need at least Docker 1.12 set up. I was using the stable version of Docker for mac for preparing this guide.

$ docker --version
Docker version 1.12.0, build 8eab29e

You also need Docker machine installed.

@ShX
ShX / unified-upload.directive.js
Created April 21, 2017 07:25
Wrong directive (AngularJS 1.0.4)
"use strict";
angular.module("uploadModule")
.directive("unifiedUpload", function () {
return {
restrict: 'E'
, scope: {}
, controller: function ($scope, TRANSFER_METHODS) {
angular.extend($scope, {
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@ShX
ShX / docker.sh
Created September 30, 2014 12:39 — forked from aluedeke/gist:7977839
# Add the docker group if it doesn't already exist.
sudo groupadd docker
# Add the connected user "${USERNAME}" to the docker group.
# Change the user name to match your preferred user.
# You may have to logout and log back in again for
# this to take effect.
sudo gpasswd -a ${USERNAME} docker
# Restart the docker daemon.
@ShX
ShX / add_xkb_ua_mac_layout.sh
Last active December 30, 2015 03:18
Add ''Ukrainian (Macintosh)" layout to Ubuntu
#!/bin/bash
CODE='mac'
NAME='Ukrainian (Macintosh)'
cat >>/usr/share/X11/xkb/symbols/ua <<EOL
partial alphanumeric_keys
xkb_symbols "$CODE" {
include "ua(legacy)"
section {
padding-top: 60px;
}
.subnav {
margin-bottom: 60px;
width: 100%;
height: 36px;
background-color: #eeeeee; /* Old browsers */
background-repeat: repeat-x; /* Repeat the gradient */
@ShX
ShX / config.rb
Created March 28, 2013 13:06 — forked from timkelty/config.rb
# Note that while this file is in our config folder, it is
# symlinked to our site folders, so paths are relative from there
# Require gems and Compass plugins
# require 'rgbapng'
# require 'compass-fancybox-plugin'
require 'compass-growl'
# General
output_style = :expanded