Skip to content

Instantly share code, notes, and snippets.

View steppefox's full-sized avatar
🦥

Eldar Amantay steppefox

🦥
View GitHub Profile
@steppefox
steppefox / elasticsearch.monit
Created June 11, 2013 05:32
Snippet for monit configuration file. Its check process named "elasticsearch" and start it, if elasticsearch is down.
check process elasticsearch with pidfile /var/run/elasticsearch.pid
start program = "/etc/init.d/elasticsearch start"
stop program = "/etc/init.d/elasticsearch stop"
if 5 restarts within 5 cycles then timeout
@steppefox
steppefox / js_in_array.js
Created June 13, 2013 06:47
javascript in_array snippet like php function; needle (ru: игла) - what we want to find; haystack (ru: стог) - where;
function in_array(needle, haystack, strict) {
//original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
var found = false, key, strict = !!strict;
for (key in haystack) {
if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
found = true;
break;
}
}
@steppefox
steppefox / yii_error_handler.php
Created June 13, 2013 10:21
Yii error_handler config in config/main.php
'components' => array(
'errorHandler'=>array(
'errorAction'=>'/site/error',
),
...
),
#city_map label { width: auto; display:inline; }
#city_map img { max-height: none; max-width: none; }

Backend Architectures

ARCHITECTURES

ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats

@steppefox
steppefox / js_countdown.js
Created July 15, 2013 17:05
Simple countdown on javascript
timeend= new Date();
timeend= new Date(2013,0,1);
// для задания обратного отсчета до определенной даты укажите дату в формате:2013,0,1
// timeend= new Date(ГОД, МЕСЯЦ-1, ДЕНЬ);
// Для задания даты с точностью до времени укажите дату в формате:
// timeend= new Date(ГОД, МЕСЯЦ-1, ДЕНЬ, ЧАСЫ-1, МИНУТЫ);
function time() {
today = new Date();
today = Math.floor((timeend-today)/1000);
@steppefox
steppefox / ffmpeg_compile.md
Created July 30, 2013 13:41 — forked from faleev/gist:3435377
Ffmpeg compile instruction in Ubuntu

Compile FFmpeg on Ubuntu

This guide supports Ubuntu Precise Pangolin 12.04, Ubuntu Oneiric Ocelot 11.10, Ubuntu Natty Narwhal 11.04, and Ubuntu Maverick Meerkat 10.10. Separate guides are available for Ubuntu Lucid Lynx 10.04 and Ubuntu Hardy Heron 8.04. This guide will enable several external encoding and decoding libraries: libfaac (AAC encoder), libfdk-aac (AAC encoder), libmp3lame (MP3 encoder), libopencore-amr (AMR encoder/decoder), librtmp (for additional RTMP protocols), libtheora (Theora encoder), libvorbis (Vorbis encoder), libvpx (VP8 encoder/decoder), and libx264 (H.264 encoder). These are optional and may be omitted if desired. This guide will also install many filters (see the filter list in the [Filtering Guide](https://ffmpeg.org/trac/ffmpeg/wiki/Fi

@steppefox
steppefox / js_size.js
Created September 3, 2013 05:38
size of analog in js
//Проверка пустоты объекта ~size ~sizeof
var size = function (obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};
@steppefox
steppefox / js_in_array.js
Created September 3, 2013 05:38
in_array analog in js
//Вхождение в массив
var in_array = function (needle, haystack, strict) {
//original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
var found = false, key, strict = !!strict;
for (key in haystack) {
if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
found = true;
break;
}