Skip to content

Instantly share code, notes, and snippets.

@thiagooak
thiagooak / ffmpeg.sh
Last active June 30, 2020 05:39
ffmpeg
ffmpeg -i video_file_name.ext -r 1 image-%04d.jpeg # creates a jpeg for every second of a video
@thiagooak
thiagooak / TestTimesListener.php
Created January 9, 2015 13:14
phpunit slow tests
<?php
/**
* source: https://jameshd.wordpress.com/2014/11/12/slow-phpunit-tests/
*/
class TestTimesListener implements PHPUnit_Framework_TestListener
{
/**
* Anything above this threshold is deemed slow
* @var float $seconds
@thiagooak
thiagooak / 0_reuse_code.js
Created January 22, 2014 21:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@thiagooak
thiagooak / mogilefs-setup
Created December 30, 2013 17:00
mogilefs setup
$ mysql -u root -p
mysql> create database mogilefs;
mysql> grant all on mogilefs.* to 'mogile'@'%' identified by 'mogilepw';
mysql> flush privileges;
mysql> quit
$ mogdbsetup --yes --dbname=mogilefs --dbuser=mogile --dbpassword=mogilepw
$ cat > /etc/mogilefs/mogilefsd.conf <<EOF
daemonize = 1
@thiagooak
thiagooak / kill-rmq-connections.sh
Created December 13, 2013 12:11
kill ALL rabbitmq connections
rabbitmqctl list_connections pid port state user vhost recv_cnt send_cnt send_pend name | awk '{print "rabbitmqctl close_connection \"" $1 "\" \"manually closing idle connection\"" | "/bin/bash" }'
@thiagooak
thiagooak / awk_csv.sh
Created December 12, 2013 22:02
awk csv
| awk 'BEGIN { OFS = ","} { printf $1 "," }'
@thiagooak
thiagooak / git-unchanged.sh
Created December 10, 2013 12:31
git assume unchanged - temporarily ignore file
# ignore
git update-index --assume-unchanged <file>
# stop ignoring
git update-index --no-assume-unchanged <file>
@thiagooak
thiagooak / fast-dump-restore.sql
Last active December 30, 2015 04:18
fast mysql dump restore
SET AUTOCOMMIT=0;
SET UNIQUE_CHECKS=0;
SET FOREIGN_KEY_CHECKS=0;
-- DUMP HERE
SET FOREIGN_KEY_CHECKS=1;
SET UNIQUE_CHECKS=1;
SET AUTOCOMMIT=1;
COMMIT;
@thiagooak
thiagooak / table-size.sql
Created November 12, 2013 13:10
Check size of MySql tables
SELECT table_name AS "table",
round(((data_length + index_length) / 1024 / 1024 / 1024), 5) "GB"
FROM information_schema.TABLES
WHERE table_schema = "database-name"
ORDER BY GB DESC;
@thiagooak
thiagooak / daemontools-centos5.sh
Created November 1, 2013 12:56
Creating a Daemon on CentOS 5 using DaemonTools
# daemontools on centos 5
# based on http://cr.yp.to/daemontools/install.html
# install
mkdir -p /package && chmod 1755 /package && cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
gunzip daemontools-0.76.tar && tar -xpf daemontools-0.76.tar && cd admin/daemontools-0.76
# centos 5 fix
echo 'gcc -include /usr/include/errno.h -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings' > src/conf-cc