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 / mux.sh
Last active December 10, 2015 21:08
Mux SQL files
#!/bin/bash
rm -f ./mux.sql;
rm -f ./tmp.list;
RES=`echo ""`
ITEM=`echo ""`
for file in `git ls-files`
do
HASH=`git rev-list HEAD $file | tail -n 1`
DATE=`git show -s --format="%ct" $HASH --`
ITEM=$(printf "%s %s\n" $DATE $file >> tmp.list)
@tomasfejfar
tomasfejfar / gist:4708522
Created February 4, 2013 18:24
Nasty bug/fail in Zend_View_Abstract
<?php
/**
* Clear all assigned variables
*
* Clears all variables assigned to Zend_View either via {@link assign()} or
* property overloading ({@link __set()}).
*
* @return void
*/
public function clearVars()
@tomasfejfar
tomasfejfar / setup-vpn.sh
Last active December 16, 2015 01:19
Fork of https://raw.github.com/cwaffles/ezpptp/master/ezpptp.sh Simple script to start PPTP VPN on debian I tried to fix to work on my virtual
#!/bin/bash
# Interactive PoPToP install script for an OpenVZ VPS
# Tested on Debian 5, 6, and Ubuntu 11.04
# April 2, 2013 v1.11
# Author: Commander Waffles
# http://www.putdispenserhere.com/pptp-debian-ubuntu-openvz-setup-script/
 
echo "######################################################"
echo "Interactive PoPToP Install Script for an OpenVZ VPS"
echo
@tomasfejfar
tomasfejfar / salt-cmd.sh
Created April 11, 2013 17:53
Useful Salt stack commands
# last job
sudo salt-run jobs.list_jobs | tac | grep -P ^'.*':$ -m 1 -B 9999 | tac
@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 / 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 \
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"
@tomasfejfar
tomasfejfar / gist:e3607569e6a38424e7cf2d9d56187815
Created June 8, 2016 10:13
Minionless gitfs bug workaround that copies commented out formulas from minion settings to /srv/salt for local usage
#! /bin/bash
grep http /etc/salt/minion.d/settings.conf | cut -c6- | xargs -n1 git clone
find /home/tomas/ -type d -name "*formula" -exec git --git-dir={}/.git --work-tree={} pull origin master \;
find /home/tomas/ -type d -name "*formula" -exec sh -c "git --git-dir={}/.git --work-tree={} archive master | tar -x --strip-components 0 -C /srv/salt/" \;