This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sysbench \ | |
--test=/usr/share/doc/sysbench/tests/db/insert.lua \ | |
--mysql-host=127.0.0.1 \ | |
--mysql-port=3306 \ | |
--mysql-user=sysbench \ | |
--mysql-password=sysbench \ | |
--mysql-db=sysbench \ | |
--mysql-table-engine=innodb \ | |
--oltp-test-mode=complex \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fac() | |
{ | |
[ $1 -eq 0 ] && echo 1 && return | |
seq $1 |tr '\n' '*'|sed 's/*$//g' | bc | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "java" | |
require "clojure.jar" | |
java_import "clojure.lang.LockingTransaction" | |
java_import "clojure.lang.Ref" | |
counter = Ref.new(0) | |
puts "Initial value : #{counter.deref}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[ $# -eq 0 ] && { | |
echo "usage: salt <length>">&2 | |
exit | |
} | |
strings </dev/urandom | while read line; do | |
echo $line | tr '\n\t ' $RANDOM:0:1 >> /tmp/.salt.$$ | |
salt=$(cat /tmp/.salt.$$) | |
[ ${#salt} -ge $1 ] && salt=${salt:0:$1} && echo $salt && break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@lucid64:~/mootools# ./xbackup.sh full | |
Backup type: full | |
Backup job started: Tue May 7 18:01:40 PDT 2013 | |
Running full backup /backup//bkps/2013-05-07_18_01_40 | |
Checking disk space ... (data: 29516) (disk: 75403716) | |
Xtrabackup started: Tue May 7 18:01:40 PDT 2013 | |
Backing up with: /usr/bin/innobackupex --no-timestamp /backup//bkps/2013-05-07_18_01_40 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@lucid64:~/mootools# ./xbackup.sh | |
usage: xbackup.sh <type> [ts] [incremental-basedir] | |
Where | |
<type> is full or incr | |
[ts] is a timestamp to mark the backup with. defaults to $(date +%Y-%m-%d_%H_%M_%S) | |
[incremental-basedir] if <type> is incr, this will be passed to --incremental-basedir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#very simple script to track time spent on tasks | |
#assumes: | |
# - you are single threaded, so no concurrent tasks | |
# - if you punch in to a task while you are punched into another one, you're punched out from the latter | |
# - you only care about accuracy down to minute intervals | |
# - you have a running mysql instance in localhost | |
# - you're not replicating this anywhere, you don't expect this to grow a lot, since the schema is stupid and has no keys other than PK, etc. This is only meant to help you track your daily work hours, you should be permanently saving those somewhere else. | |
# - you just want to track time. you don't really care about performance for this little helper script (i.e. it runs the CLI several times in a row instead of keeping an open connection) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in $(seq 40000); do mysql -e "create database test_$i"; for j in $(seq 250); do mysql test_$i -e "create table test_$j (id int not null auto_increment primary key) engine=innodb; insert into test_$j values (null),(null),(null);"; done; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires : employees dataset (https://dev.mysql.com/doc/employee/en/) | |
# Then just create table employees_idx_on_hire_date like employees; alter table employees_idx_on_hire_date add key (hire_date); | |
# Pick one of these: | |
cat<<EOF>query.txt | |
select * from employees.employees_idx_on_hire_date order by hire_date desc limit 10 | |
EOF | |
cat<<EOF>query.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; show matching parenthesis | |
(show-paren-mode 1) | |
;; evil mode always on so I can keep using the vim shortcuts I know | |
(evil-mode 1) | |
(add-to-list 'load-path "/Users/fernandoipar/.emacs.d/") | |
;; logito, pcache, tabulated list, gh-ghist, required by gist | |
(require 'logito) | |
(require 'pcache) |