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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<p>
&lt;math&gt;2+2&lt;/math&gt;
@macbre
macbre / slack_nagios.sh
Last active March 23, 2018 10:43 — forked from matt448/slack_nagios.sh
Script to post Nagios notifications into a Slack channel // SUS-4340
#!/bin/bash
# This script is used by Nagios to post alerts into a Slack channel
# using the Incoming WebHooks integration. Create the channel, botname
# and integration first and then add this notification script in your
# Nagios configuration.
#
# All variables that start with NAGIOS_ are provided by Nagios as
# environment variables when an notification is generated.
# A list of the env variables is available here:
@macbre
macbre / BYGD.csv
Created February 17, 2018 10:24
IB01030 Population by sex, age and village/city, 1th January (1985-2017)
sex village/city 2017
Total (sex) Total Faroe Islands 49864
Total (sex) Hattarvík 13
Total (sex) Kirkja 32
Total (sex) Svínoy 29
Total (sex) Viðareiði 352
Total (sex) Depil 1
Total (sex) Hvannasund 236
Total (sex) Múli -
Total (sex) Norðdepil 166
@macbre
macbre / statsdb.sql
Created January 12, 2018 14:14
Query logs
d = '155065' AND namespace_id = '6' AND article_id = '31922' ORDER BY pv DESC LIMIT 200
SELECT article_id, pageviews FROM rollup_wiki_article_pageviews WHERE article_id IN ( '2411', '2650', '2661', '2136', '2614', '2098', '2830', '2721', '2133' ) AND time_id = '2017-12-10 00:00:00' AND wiki_id = '931547' AND period_id = '2'
SELECT 1 as c FROM rollup_wiki_article_pageviews WHERE time_id = '2018-01-07 00:00:00' AND period_id = '2' LIMIT 1
SELECT namespace_id as namespace,sum(edits) as count FROM `rollup_wiki_namespace_user_events` WHERE user_id = '27446087' AND period_id = '1' GROUP BY namespace_id
SELECT date_format(time_id,'%Y-%m-%d') AS date, pageviews AS cnt FROM rollup_wiki_pageviews WHERE period_id = '1' AND wiki_id = '610' AND time_id BETWEEN '2017-10-18' AND '2018-01-10'
SELECT wiki_id,SUM(edits) AS edits FROM `rollup_wiki_user_events` WHERE period_id = '3' AND (time_id >= NOW() - INTERVAL 90 DAY)
@macbre
macbre / statsdb.tsv
Last active January 12, 2018 08:53
StatsDB queries / data warehouse
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 1.
# Query digest for "statsdb" database, found 270548 queries
statsdb:rollup_wiki_article_pageviews doGetTopArticlesByPageview DataMartService 1.00 ap, median time: 53.72 ms, count: 12683300
statsdb:rollup_wiki_article_pageviews findLastRollupsDate DataMartService 0.12 ap, median time: 405.35 ms, count: 1548600
statsdb:rollup_wiki_namespace_user_events editsByNsAll Editcount 0.00 ap, median time: 6504.56 ms, count: 5400
statsdb:rollup_wiki_pageviews getPageviews DataMartService 0.54 cron, median time: 36.38 ms, count: 6910500
statsdb:rollup_wiki_article_pageviews getPageViewsForArticles DataMartService 0.07 cron, median time: 39.60 ms, count: 845900
statsdb:rollup_wiki_article_pageviews getPageViewsForArticles DataMartService 0.00 ap, median time: 48.71 ms, count: 27700
statsdb:fact_wam_scores getWamIndex WAMService 0.01 ap, median time: 1782.51 ms, count: 69500
statsdb:dimension_wikis getWamIndex WAMService 0.01 ap, median time: 1782.51 ms, count: 69500
statsdb:rollup_wiki_user_events getTopWikisFromDb Favorit
@macbre
macbre / .gitignore
Last active January 26, 2018 19:11
Blogspot stats (from XML dump)
env*
@macbre
macbre / requirements.txt
Last active December 29, 2017 19:06
Grim Fandango
$ ldd GrimFandango
linux-gate.so.1 (0xf7778000)
libLua.so => ./libLua.so (0xf7749000)
libchore.so => ./libchore.so (0xf773f000)
libSDL2-2.0.so.1 => ./libSDL2-2.0.so.1 (0xf7621000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf75e8000)
libGL.so.1 => not found
libGLU.so.1 => not found
libX11.so.6 => not found
libstdc++.so.6 => not found
@macbre
macbre / remove_dangling_images.sh
Created December 29, 2017 13:53
Docker helpers
#!/bin/bash
docker rmi -f $(docker images -f "dangling=true" --format "{{.ID}}")
@macbre
macbre / bots.tsv
Last active December 22, 2017 12:34
Elecena crawling bots data flow
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 4. in line 1.
# processed 500 packets sniffed in 4346.42 sec as None
s0 bots-server 1.0000
bjornoya bots-server 0.9847
sphinx bots-server 0.5663
# processed 2000 packets sniffed in 275.36 sec as redis
mq::elecena_products::messages lpop consumer:bjornoya 1.0000
mq::elecena_products::messages lpop consumer:svalbard 0.5018
bots-server rpush mq::elecena_datasheets::messages 0.1816
bots-server rpush mq::elecena_products::messages 0.0073
@macbre
macbre / example.tsv
Last active December 18, 2017 22:15
data-flow redis ngrep
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
# processed 2000 packets sniffed in 275.36 sec as redis
mq::elecena_products::messages lpop 172.17.0.3
86.105.54.80 rpush mq::elecena_products::messages
mq::elecena_products::messages lpop 86.105.54.80
86.105.54.80 rpush mq::elecena_datasheets::messages