Skip to content

Instantly share code, notes, and snippets.

View kastner's full-sized avatar
🕳️
actively choosing...

Erik Kastner kastner

🕳️
actively choosing...
View GitHub Profile
@keyurdg
keyurdg / mysql_query_multiplexer.go
Created March 18, 2013 19:01
Read output from pt-query-digest and multiplex queries to MySQL over multiple threads.
package main
import (
"bufio"
"bytes"
_ "github.com/Go-SQL-Driver/MySQL"
"database/sql"
"flag"
"fmt"
"io"
@keyurdg
keyurdg / alter_generator.php
Created March 18, 2013 18:58
Generate ALTERs for all tables using MySQL's UTF8 character set. Also bump up any TEXT columns to LONGTEXT.
<?php
if (!isset($argv[1]) || strlen($argv[1]) < 1 ||
!isset($argv[2]) || strlen($argv[2]) < 1 ||
!isset($argv[3]) || strlen($argv[3]) < 1 ||
!isset($argv[4]) || strlen($argv[4]) < 1 ) {
echo "{$argv[0]} <hostname> <dbname> <login-name> <login-password> is the way to go!\n";
die();
}
@shantanuo
shantanuo / schema_convert.sh
Last active February 10, 2021 09:21
script to convert mysql schema to be compatible with data warehouse software
#!/bin/sh
# script to convert mysql schema to be compatible with data warehouse software
# make sure that s3cmd and maatkit utility is installed
db_name=${1:-'test'}
> /root/$db_name.txt
temppath='/mnt/data/pdump1'
host='localhost'
user='maatkit'
@ndarville
ndarville / examples.mdown
Last active December 9, 2019 11:32
“We’ve Been Hacked” Boilerplate Announcement

How Companies Communicated Being Hacked

It’s probably a pretty bad idea to have your site go down, when people are supposed to read the blog post explaining the hack.

Notice how another site reporting the hack received more attention than Twitter’s own announcement. Why was that?

@shantanuo
shantanuo / mysql_to_redshift.sh
Last active January 27, 2020 15:38
Make sure that the package s3cmd is installed and PHP supports pgsql driver. time sh -xv mysql_to_redshift.sh test email_lists This will create a text file createme.sql.txt
#!/bin/sh
# download this script
# make sure s3cmd is installed
# yum install s3cmd
# if yum mentioned above does not work then
# wget http://downloads.sourceforge.net/project/s3tools/s3cmd/1.5.0-alpha1/s3cmd-1.5.0-alpha1.tar.gz
# tar xvf s3cmd-1.5.0-alpha1.tar.gz
# cd s3cmd-1.5.0-alpha1
# python setup.py install
# python 2.6+ is required
@raggi
raggi / validate_local_cache.sh
Last active December 11, 2015 23:39
A script to validate your local gem cache against the public s3 repositories. If you find mismatches that contain both local and remote values, please post them in comments.
#!/usr/bin/env sh
if ! which md5sum > /dev/null; then
echo Install md5sum
exit 1
fi
if ! which curl > /dev/null; then
echo Install curl
exit 1
@textarcana
textarcana / centos-install-syntax-highlighting-in-less.sh
Last active May 1, 2023 01:01
2020 update: just use bat(1) instead!!!! bat has git integration and also can show invisible characters! OLD STUFF: How to enable syntax-highlighting in less. Use `less -N` (or type -N while in less) to enable line numbers. Based on the procedure described in http://superuser.com/questions/71588
# Enable syntax-highlighting in less.
# Last tested on CentOS 6.3.
#
# First, add these two lines to ~/.bashrc
# export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
# export LESS=" -R "
sudo yum -y install boost boost-devel ctags
wget http://springdale.math.ias.edu/data/puias/unsupported/6/x86_64/source-highlight-3.1.6-3.puias6.x86_64.rpm
@paulczar
paulczar / logstash-perf.md
Last active May 14, 2018 03:13
logstash performance deets

Logstash Performance Testing

Server Details

HP BL460

  • 48 Gb Memory
  • 2 x X5675 @ 3.07GHz
  • 2 x 10 gbps NIC
  • 2tb NetApp NFS volume for ES data
@tiegz
tiegz / README.markdown
Created August 3, 2012 18:15
DTrace probes for ruby 1.9.3-HEAD

What?

This is a starting point to get something similar to memprof running in ruby 1.9. So far it adds DTrace probes to ruby 1.9.3, which we output and parse at some point later.

This will generate 2 types of probes so far:

  • RUBY_OBJ_NEW(): capture the file, line and type of a newly allocated object.
  • RUBY_CALL(): capture the function name of every function called. 😱

Partly inspired by this blog post: http://tenderlovemaking.com/2011/06/29/i-want-dtrace-probes-in-ruby.html