Skip to content

Instantly share code, notes, and snippets.

@jonathanvx
jonathanvx / gist:64cb8320ab83d3264893
Last active August 29, 2015 14:16
Update By Date - Stored Procedure
delimiter $$
drop procedure if exists update_by_date$$
CREATE PROCEDURE update_by_date(IN startdate DATE, IN enddate date)
PROC:BEGIN
DECLARE idate date;
DECLARE cr BIGINT;
DECLARE done INT DEFAULT FALSE;
-- requires data_dimension table - be found in my github repo
DECLARE curs1 CURSOR FOR SELECT date FROM date_dimension WHERE date between startdate and enddate;
@jonathanvx
jonathanvx / gist:7656383
Last active December 29, 2015 10:19
My Windows Powershell script (.bat file) that automatically converts all your *.mov files in a directory (usually movies made from DSLRs) to very high quality (and very slow conversion) mp4 movies using Handbrake. Bitrate is set to 3500kb/s (take into account that the compression is very good - try it and see). Audio is 128/44.1k. Output directo…
for /r %%i in (*.mov) do "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "%%i" -t 1 -o "D:\%%~ni.mp4" -f mp4 --strict-anamorphic -e x264 -b 3500 -2 -T --vfr -a 1 -E faac -B 128 -6 dpl2 -R 44.1 -D 0 --gain=0 --audio-copy-mask none --audio-fallback ffac3 -x ref=6:weightp=1:rc-lookahead=10:b-adapt=2:bframes=6:me=umh:subq=9:merange=32
@jonathanvx
jonathanvx / convertall.sh
Created May 21, 2012 14:24
Burst Convert all tables to InnoDB
#!/bin/bash
MAX1=`mysql -e"select @@global.max_connections;" -N -B`
MAX=$[$MAX1 - 5]
echo "select table_name from information_schema.tables where engine='myisam' and table_schema='dbname' order by DATA_LENGTH desc limit $MAX;" | mysql --database=dbname -B -N | awk '{print "mysql dbname -e\"set sql_log_bin=0; ALTER TABLE", $1, "engine=innodb;\" &"}' > /tmp/massconvert.sh
bash /tmp/massconvert.sh
rm -f /tmp/massconvert.sh
echo "select table_name from information_schema.tables where engine='myisam' and table_schema='dbname' order by DATA_LENGTH desc limit $MAX,99999;" | mysql --database=dbname -B -N | awk '{print "set sql_log_bin=0; ALTER TABLE", $1, "engine=innodb;"}' | mysql --database=dbname -f &