Skip to content

Instantly share code, notes, and snippets.

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

Tomáš Fejfar tomasfejfar

🏠
Working from home
View GitHub Profile
@tomasfejfar
tomasfejfar / compare.php
Created June 19, 2013 16:35
Compare two ini files with different formats. Will sort the keys and dump php arrays. Really useful for mysql/apache conf.
<?php
/**
* INI configurations compare
*
* Usage: php compare.php file1.ini file2.ini
* Result: Will export sorted arrays into *.res files to use with normal diff tool
*/
$x = parse_ini_file($argv[1],true);
$y = parse_ini_file($argv[2],true);
ksort($x);
dataQuery = {
"query" : {
"custom_filters_score" : {
"query" : {
"match" : { "_all" : query }
},
"filters" : [
{
"filter" : { "term" : {"_type" : "ticket"} },
"boost" : 1.5
@tomasfejfar
tomasfejfar / hostname.py
Created August 22, 2013 15:29
hostname resolver
import socket
def resolve(hostname):
return socket.gethostbyname(hostname)
@tomasfejfar
tomasfejfar / gist:7909047
Created December 11, 2013 11:48
Icinga spam blacklist check config
define command {
command_name check_rbl
command_line /opt/check_rbl/check_rbl -t 60 -H $HOSTADDRESS$ \
-s dnsbl.ahbl.org \
-s cbl.abuseat.org \
-s dnsbl.cyberlogic.net \
-s bl.deadbeef.com \
-s spamtrap.drbl.drand.net \
-s spamsources.fabel.dk \
-s 0spam.fusionzero.com \
@tomasfejfar
tomasfejfar / diff.path
Created March 31, 2014 19:54
diff between nginx (2) and apache (1)
--- /2.txt po III 31 21:31:58 2014
+++ /1.txt po III 31 21:31:48 2014
@@ -4,13 +4,14 @@
GD Version bundled (2.1.0 compatible)
FreeType Support enabled
FreeType Linkage with freetype
-FreeType Version 2.4.10
+FreeType Version 2.4.9
+T1Lib Support enabled
GIF Read Support enabled
@tomasfejfar
tomasfejfar / gist:6da337de445d823442fa
Last active August 29, 2015 14:04
Jaký je business case pro DJ Supermarket?
  • nutně něco potřebuju, abych si mohl uvařit
    • chci si koupit kypřící prášek, vajíčka a vanilkový lusk (protože plánuju péct a nemam nakoupeno a tohle mi chybí)
    • nejvíc mě zajímá čas doručení
    • na DJS nefunguje, protože minimální obj. je 500, než řešit co všechno objednám za 500, tak si skočim do Žabky
  • nákup něčeho co se mi nechce tahat
    • zajímá mě přesnost doručení na plánovaný čas + čas (že to není třeba do druhého dne)
    • když si to takhle naplánuju, tak objednám přes oběd a chci aby mi to dorazilo večer až budu doma
    • zajímá mě sortiment (mají třeba mlíko "s uzávěrem"?)
    • méně mě zajímají malé rozdíly v ceně (~2-5kč na mléce) - kupuju abych to netahal, ne abych ušetřil
  • periodické nákupy
@tomasfejfar
tomasfejfar / bring-to-front.js
Created November 14, 2014 17:17
SVG bring to front
svgBringToFront = function (domElement) {
var parent = domElement.parentElement;
parent.removeChild(domElement);
parent.appendChild(domElement);
}
{
"_index": "logstash-2015.04.14",
"_type": "accesslog",
"_id": "zpnGd2u2Tta2kePty2bDfA",
"_version": 1,
"_score": 1,
"_source": {
"message": "127.0.0.1 - - [14/Apr/2015:14:02:33 +0000] "GET /server-status?auto HTTP/1.1" 401 194 "-" "collectd/5.1.0"",
"@version": "1",
"@timestamp": "2015-04-14T14:55:03.684Z",
USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
elastics 20 0 9005m 2,6g 34m S 6,0 33,0 2779:33 java
logstash 39 19 1059m 409m 6332 S 3,9 5,1 3352:36 java
root 20 0 259m 41m 3392 S 0,1 0,5 4:51.60 salt-minion
root 20 0 737m 126m 3792 S 0,1 1,6 28:26.23 node
@tomasfejfar
tomasfejfar / .gitconfig
Created May 9, 2016 12:11
Command to create remote stash
[alias]
; creates timestamped branch rst-XXXXX and pushes it to default remote (origin)
rst = "!rst() { export tmpBranch=rst-$(date +%s) && git add -A && git checkout -b $tmpBranch && git commit -m 'WIP remote stash' && git push --set-upstream origin $tmpBranch; }; rst"