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 / 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 / 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:
#!/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 / 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

@macbre
macbre / .gitignore
Last active October 11, 2017 10:28
MySQL 5.6 vs 5.7 performance comparison
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 20, 2017 10:09
SUS-3072 user queries analyzed
env/
*.swp
@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 / log.sql
Created October 28, 2017 17:10
Elecena SQL log
-- bots
SELECT * FROM products WHERE prod_id IN (7205887,7895047,7895046,7989641,9369286,9369287,9369890,9369891,9369895,9369896,9552054,9552055,9557908,9631579,1011753,1035788,1212991,1010860,1010861,1009436,2788153,4583962,1012990,1012987,1012985,1009476,1009477,1009478,1009479,1009480,1009481,1009482,1009484,1009485,1009486,1009488,1009487,1009489,1009483,1010957,1011751,1012979,1012957,1012958,1012959,1009504,1010856,1016005,1010142,1009439,1012944,1009490,1012946,1010141,1010149,1014468,1012963,1012962,1011752,1013029,1010858,1012789,1012971,1012973,1012974,1012975,1012976,1012977,1012978,1014431,1012980,1012948,1010863,1009437,1009438,1010857,1012984,1009741,1010864,1012981,1012982,1009428,1010262,1012992,1010139,1012986,1010305,1010306,1009440,1009442,1009441,1009443,1009444,1012942,1010215,1033572,1012964,1212993,1212994,1009433,1212996,1212995,1212992,1012949,1016007,1016009,1016008,1010169,1031334,1009502,1012956,1012960,1212997,1014286,1010148,1010143,1009422,1009423,1009424,1009425,1009426,1009427
@macbre
macbre / events.log
Created November 4, 2017 14:35
index-digest
$ index_digest mysql://foo:bar@server/stats
------------------------------------------------------------
Found 5 issue(s) to report for "stats" database
------------------------------------------------------------
MySQL v5.6.24-72.2-log at statsdb-s2
index-digest v0.1.0
------------------------------------------------------------
redundant_indices → table affected: events
✗ "user_id_idx" index can be removed as redundant (covered by "for_editcount_idx")