Skip to content

Instantly share code, notes, and snippets.

View macbre's full-sized avatar
🏠
Working from home

Maciej Brencz macbre

🏠
Working from home
View GitHub Profile
@macbre
macbre / tcpdump.txt
Created October 26, 2017 18:42 — forked from gstark/tcpdump.txt
Use tcpdump to monitor mysql
Use tcpdump to monitor mysql
# Capture the packets
sudo tcpdump -i eth0 port 3306 -s 65535 -x -n -q -tttt > tcpdump.out
# analyze all the requests from a given host
pt-query-digest --type=tcpdump --filter '($event->{host} || $event->{ip} || "") =~ m/192.168.248.64/' tcpdump.out
@macbre
macbre / .gitignore
Last active October 20, 2017 10:09
SUS-3072 user queries analyzed
env/
*.swp
@macbre
macbre / fix-image.php
Last active October 18, 2017 10:12
SUS-2468 - no-break space in file names
#!/usr/bin/env php
<?php
# var_dump($argv);
# run it by providing "200298-1545" pair of city_id and page_id
list($cityId, $pageId) = explode('-', $argv[1]);
putenv('SERVER_ID=' . $cityId);
@macbre
macbre / .gitignore
Last active October 11, 2017 10:28
MySQL 5.6 vs 5.7 performance comparison
env/
*.swp
@macbre
macbre / README.md
Created August 22, 2017 09:40
VPN DNS

Second, disconnect from the VPN. Edit /etc/NetworkManager/NetworkManager.conf

$ sudo gedit /etc/NetworkManager/NetworkManager.conf

and comment out

dns=dnsmasq

#!/bin/bash
NS_ID=$1
NS_NAME=$2
DB_PARAMS=`dbparams.pl --name=diepioconception --type=slave`
mysql $DB_PARAMS --silent --skip-column-names -e "set charset 'latin1'; SELECT CONCAT('$NS_NAME', ':', page_title) FROM page where page_namespace = ${NS_ID}"
@macbre
macbre / http.tsv
Last active July 17, 2017 10:38
HTTP requests sent by MediaWiki grouped by caller
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 5 in line 1.
# HTTP requests sent by MediaWiki grouped by caller (16336352 requests analyzed)
mediawiki-app Helios Helios 0.0840 201.26 qps, resp. times: p50 = 1.00 ms / p95 = 3.00 ms / p99 = 7.00 ms
mediawiki-app ChatServerApiClient:makeRequest ChatServerApiClient:makeRequest 0.0002 0.55 qps, resp. times: p50 = 1.00 ms / p95 = 5.00 ms / p99 = 14.29 ms
mediawiki-app template-classification-storage template-classification-storage 0.0274 65.56 qps, resp. times: p50 = 1.00 ms / p95 = 3.00 ms / p99 = 7.00 ms
mediawiki-app site-attribute site-attribute 0.0008 2.00 qps, resp. times: p50 = 2.00 ms / p95 = 4.00 ms / p99 = 9.00 ms
mediawiki-app File:getDescriptionText File:getDescriptionText 0.0002 0.41 qps, resp. times: p50 = 94.00 ms / p95 = 295.13 ms / p99 = 533.82 ms
mediawiki-app PhalanxService:sendToPhalanxDaemon PhalanxService:sendToPhalanxDaemon 0.3101 742.87 qps, resp. times: p50 = 0.00 ms / p95 = 2.00 ms / p99 = 6.00 ms
mediawiki-app ESFandomSearchService:select ESFandomSearchService:select 0.0015 3.55 qps, resp. times:
@macbre
macbre / jquery.txt
Last active July 12, 2017 13:22
Unused files report
$ for FILE in `find -name *.js | grep jquery | sed 's/\.\///g' | grep '^resources'`; do echo "Checking ${FILE}..."; ack-grep --php "$FILE"; done;
Checking resources/wikia/polyfills/jquery.wikia.placeholder.js...
extensions/wikia/AssetsManager/config.php
415: '//resources/wikia/polyfills/jquery.wikia.placeholder.js',
Checking resources/wikia/libraries/mustache/jquery.mustache.js...
resources/wikia/Resources.php
243: 'scripts' => 'resources/wikia/libraries/mustache/jquery.mustache.js',
Checking resources/wikia/libraries/jquery/ellipses.js...
extensions/wikia/AssetsManager/config.php
359: '//resources/wikia/libraries/jquery/ellipses.js',
@macbre
macbre / .gitignore
Last active December 15, 2017 10:22
SUS-2289
env/
*.swp
@macbre
macbre / check.sh
Last active July 3, 2017 11:52
SUS-2288
#!/bin/bash
WIKICITIES_PARAMS=`dbparams.pl --name wikicities`
for VAR_NAME in `mysql $WIKICITIES_PARAMS --batch --disable-column-names -e 'select cv_name from city_variables_pool'`
do
# echo "Checking ${VAR_NAME}.."
# check the usage in the config
# WIKIA_CONFIG_ROOT=/usr/wikia/slot1/current/config
COUNT=`ack-grep --no-filename -i --php "$VAR_NAME" $WIKIA_CONFIG_ROOT -c`