Skip to content

Instantly share code, notes, and snippets.

Shlomi Noach shlomi-noach

Block or report user

Report or block shlomi-noach

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View slack-css-override.css
/*
// Override Slack CSS
// Tested with Slack 2.8.2 Direct Download
// Instructions:
// - Append the following javascript code to:
// - /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js (MacOS/X)
// - /usr/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js (Debian/Ubuntu)
@shlomi-noach
shlomi-noach / ts-to-gnuplot.sh
Created Jan 12, 2016
Use tiemserias input (TS,value) as input to gnuplot
View ts-to-gnuplot.sh
# Assuming time series is in /tmp/ts-data.dat
# Assuming timeseries in 2015-01-02 format (change according to data)
echo '
set xdata time
set timefmt "%Y-%m-%d"
set terminal dumb size 120, 24
plot "/tmp/ts-data.dat" using 1:2 title "data pr time unit" with histeps
' | gnuplot
@shlomi-noach
shlomi-noach / brew-install.bash
Last active May 30, 2016
Useful set of brew packages to install on OS/X
View brew-install.bash
#!/bin/bash
# good brew setup for Mac OS/X
brew tap homebrew/dupes
brew install homebrew/dupes/grep
brew install go --with-cc-all
brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt
brew install git gnupg rpm npm bash-completion
@shlomi-noach
shlomi-noach / block_mysql_access.bash
Created Nov 15, 2015
Block/unblock MySQL 3306 access via iptables
View block_mysql_access.bash
#!/bin/bash
#
# Usage: block_mysql_access.bash [true|false]
# "true" or empty input blocks 3306 access, via iptables
# "false" re-enables access to 3306
#
if [ $# -eq 0 ] || [ "$1" == "true" ]; then
sudo -i /sbin/iptables -I INPUT -p tcp --destination-port 3306 -j REJECT
elif [ "$1" == "false" ]; then
@shlomi-noach
shlomi-noach / mysql-table-size-ondisk.sh
Last active Oct 19, 2015
Bash script to calculate MySQL table dimensions on disk
View mysql-table-size-ondisk.sh
#!/bin/bash
(
mysql_datadir=$(grep datadir /etc/my.cnf | head -n 1 | cut -d "=" -f 2 | cut -d "#" -f 1)
cd $mysql_datadir
for frm_file in $(find . -name "*.frm" | egrep -v "[.]/(mysql|sys|performance_schema|common_schema)")
do
table_schema=$(echo $frm_file | cut -d "/" -f 2)
table_name=$(echo $frm_file | cut -d "/" -f 3 | cut -d "." -f 1)
if [ -f ${frm_file//.frm/.MYD} ]; then
View binlog-rbr-to-sbr.py
#!/usr/bin/python
#
# Convert a Row-Based-Replication binary log to Statement-Based-Replication format, cheating a little.
# This script exists since Percona Toolkit's pt-query-digest cannot digest RBR format. The script
# generates enough for it to work with.
# Expecting standard input
# Expected input is the output of "mysqlbinlog --verbose --base64-output=DECODE-ROWS <binlog_file_name>"
# For example:
# $ mysqlbinlog --verbose --base64-output=DECODE-ROWS mysql-bin.000006 | python binlog-rbr-to-sbr.py | pt-query-digest --type=binlog --order-by Query_time:cnt --group-by fingerprint
#
You can’t perform that action at this time.