Skip to content

Instantly share code, notes, and snippets.

@dotmanila
dotmanila / zfs-bootstrap-ubuntu-16.04-git.sh
Last active November 18, 2017 05:01
ZFS bootstrap Ubuntu 16.04 with github master ZFS, uses xvdb for single vdev and PXC 5.7.19 using MySQL sandbox.
#!/bin/bash
USER=ubuntu
IP=$(ip -4 ad sh scope global | grep 'scope global' | awk '{print $2}' | cut -d'/' -f1 | head -n1)
KERNEL=$(uname -r)
wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_0.1-4.xenial_all.deb
sudo apt -y update
sudo apt -y upgrade
@dotmanila
dotmanila / zfs-bootstrap-bm-ubuntu-16.04-git.sh
Last active November 16, 2017 03:25
ZFS bootstrap Ubuntu 16.04 with git-master version, uses 6xSAS drives pool and PS 5.7.19 using MySQL sandbox.
#!/bin/bash
DISK=xvdb
USER=ubuntu
IP=$(ip -4 ad sh scope global | grep 'scope global' | awk '{print $2}' | cut -d'/' -f1 | head -n1)
KERNEL=$(uname -r)
wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_0.1-4.xenial_all.deb
sudo apt -y update
@dotmanila
dotmanila / hp-dl380-g7-test-server.txt
Last active November 10, 2017 21:08
HP DL380 G7 Test Server
# Percona Toolkit System Summary Report ######################
Platform | Linux
Release | Ubuntu 16.04.3 LTS (xenial)
Kernel | 4.4.0-98-generic
Architecture | CPU = 64-bit, OS = 64-bit
Threading | NPTL 2.23
SELinux | No SELinux detected
Virtualized | No virtualization detected
# Processor ##################################################
Processors | physical = 2, cores = 12, virtual = 24, hyperthreading = yes
@dotmanila
dotmanila / run-sysbench-ps5719.sh
Created November 10, 2017 21:14
Run 3 basic sysbench tests on Percona Server sandbox
#!/bin/bash
PREFIX=$1
time sysbench --db-driver=mysql --mysql-user=msandbox --mysql-password=msandbox \
--mysql-db=test --mysql-host=127.0.0.1 --mysql-port=57190 --tables=8 \
--table-size=20000000 --auto-inc=off --threads=8 --time=0 \
--rand-type=pareto oltp_read_only cleanup
time sysbench --db-driver=mysql --mysql-user=msandbox --mysql-password=msandbox \
@dotmanila
dotmanila / zfs-git-master-module-parameters.txt
Last active November 25, 2017 15:50
ZFS Module Parameters as of git-0.7-master
dbuf_cache_hiwater_pct 10
dbuf_cache_lowater_pct 10
dbuf_cache_max_bytes 104857600
dbuf_cache_max_shift 5
dmu_object_alloc_chunk_shift 7
ignore_hole_birth 1
l2arc_feed_again 1 1
l2arc_feed_min_ms 200 200
l2arc_feed_secs 1 1
l2arc_headroom 2 2
@dotmanila
dotmanila / clickhouse-changelog.py
Last active February 12, 2022 18:35
Python MySQL Binlog Change Data Capture for Clickhouse Example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import sys
import pymysql.cursors
from pymysqlreplication import BinLogStreamReader
from pymysqlreplication.row_event import (
DeleteRowsEvent,
@dotmanila
dotmanila / clickhouse-incr-refresh.sh
Created December 24, 2017 00:14
Clickhouse incremental refresh script using changelog data from https://gist.github.com/dotmanila/53a2c0b9b7a3be4f9e99b94aa203c66d
#!/bin/bash
_echo() {
echo "$(date +%Y-%m-%d_%H_%M_%S) incr-refresh $1"
}
TBL='hits'
# MySQL clickhouse_changelog command
MYCL="mysql -h source_db_host mydb -BNe"
# MySQL source table command
@dotmanila
dotmanila / split-file-based-on-order.sh
Created February 3, 2018 04:21
Split a file into several equal parts.
#!/bin/bash
# File should have first column as numeric
FILE=$1
cat $FILE | sort -rn > $FILE.sort
cat $FILE.sort | awk 'NR%2==0' > $FILE.1
cat $FILE.sort | awk 'NR%2==1' > $FILE.2
rm -rf $FILE.sort

Keybase proof

I hereby claim:

  • I am dotmanila on github.
  • I am revin (https://keybase.io/revin) on keybase.
  • I have a public key ASC8Pyeju_P3M6mAtkHvr-iB048ggm73oKYWbrRIKxIq6Qo

To claim this, I am signing this object:

#!/bin/sh
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
#autocutsel -fork
openbox &
/usr/bin/lxsession -s Lubuntu &