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
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; |
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
echo $sql | mysql 2>&1 | awk '{print $0 ">", sql}' sql="$sql" >> $errorlog |
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 | |
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 & |
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 /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 |
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
127.0.0.1 100PercentFedUp.com | |
127.0.0.1 21stcenturywire.com | |
127.0.0.1 369news.net | |
127.0.0.1 70news.wordpress.com | |
127.0.0.1 asheepnomore.net | |
127.0.0.1 abcnews.com.co | |
127.0.0.1 www.aim.org | |
127.0.0.1 latitudes.org | |
127.0.0.1 www.activistpost.com | |
127.0.0.1 addictinginfo.org |
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
/* | |
'year' and 'month' columns are in seperate integer columns. | |
This creates an issue when wanting reports between two different dates. | |
How can we fix this? One solution, a generated column with an index on it. | |
*/ | |
MBP@landregistry> select * from summary order by total_price desc limit 3; | |
+----------+------+-------+------------+----------------+--------------+-------------+ | |
| postcode | year | month | county | district | total_price | houses_sold | | |
+----------+------+-------+------------+----------------+--------------+-------------+ | |
| W1T | 2015 | 7 | CAMDEN | GREATER LONDON | 367075000.00 | 7 | |
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 | |
(cat <<EOF | |
[mysqld] | |
## Performance Specific ## | |
########################## | |
innodb_buffer_pool_size = 12G ### How much innodb data to store in memory. Higher = faster performance | |
innodb_file_per_table = 1 ### Each innodb table is its own file on disk. | |
innodb_flush_log_at_trx_commit = 2 ### Flushes to disk in batches instead of per change |
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
-- based on http://stackoverflow.com/questions/21767780/how-to-find-size-of-database-schema-table-in-redshift | |
SELECT name AS table_name, ROUND((COUNT(*) / 1024.0),2) as "Size in Gigabytes" | |
FROM stv_blocklist | |
INNER JOIN | |
(SELECT DISTINCT id, name FROM stv_tbl_perm) names | |
ON names.id = stv_blocklist.tbl | |
GROUP BY name | |
ORDER BY "Size in Gigabytes" DESC |
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 | |
cmd='aws rds modify-db-parameter-group --db-parameter-group-name mysql57-performance' | |
$cmd --parameters="ParameterName=tmp_table_size, ParameterValue=67108864, ApplyMethod=pending-reboot" | |
$cmd --parameters="ParameterName=max_heap_table_size, ParameterValue=67108864, ApplyMethod=pending-reboot" | |
#Max size a tmp table can be in memory | |
$cmd --parameters="ParameterName=join_buffer_size, ParameterValue=2097152, ApplyMethod=pending-reboot" | |
#Helps when a join doesn’t have an index or an index wont be more helpful than a full table scan | |
$cmd --parameters="ParameterName=sort_buffer_size, ParameterValue=2097152, ApplyMethod=pending-reboot" | |
#Helps with ORDER BY queries. |
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
import timeout_filter as tf | |
def test_timeout_filter(): | |
#TODO: create fake data with expected results from timeout_filter | |
test_data_users = "{ }" | |
test_data_venues= "{ }" | |
print tf.filter_venues(test_data_users, test_data_venues) | |
#TODO: compare filter results with expected results |
OlderNewer