Skip to content

Instantly share code, notes, and snippets.

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

vadv vadv

🏠
Working from home
  • OZON
  • Moscow
View GitHub Profile
@vadv
vadv / gist:1725277
Created February 2, 2012 19:32
munin resque
#!/usr/bin/env ruby
require 'rubygems'
require 'resque'
require 'resque-cleaner'
HOST = ENV['host'] ? ENV['host'] : 'db1.kupikupon.ru'
PORT = ENV['port'] ? ENV['port'] : '6379'
Resque.redis = "#{HOST}:#{PORT}"
@vadv
vadv / nagios.rb
Last active October 7, 2015 21:18
Лаг по времени для встроенной репликации psql для nagios
#!/usr/bin/env ruby
require 'rubygems'
require 'pg'
require 'timeout'
require 'nagios-probe'
def master_connection_string
{:user => 'nagios', :dbname => 'nagios', :host => 'master', :password => 'nagios'}
end
@vadv
vadv / fix.diff
Last active October 8, 2015 15:08
@@ -1,7 +1,9 @@
-require 'pygments'
+require 'net/http'
+require 'uri'
require 'fileutils'
require 'digest/md5'
+PYGMENTIZE_URL = URI.parse('http://pygmentize.herokuapp.com/')
PYGMENTS_CACHE_DIR = File.expand_path('../../.pygments-cache', __FILE__)
FileUtils.mkdir_p(PYGMENTS_CACHE_DIR)
@vadv
vadv / gdb.sh
Last active October 8, 2015 15:58
#!/bin/bash
for i in {1..600}
do
echo ''
date
echo ''
gdb -batch -x stack.gdb --pid=$1 < answ | grep -v "no debugging symbols found"
sleep 1
done
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
require 'ostruct'
module ErbCompile
def erb_compile(atr)
case
when atr.kind_of?(Hash), atr.kind_of?(Array) # Chef::Node::ImmutableArray
JSON.parse erb_compile(JSON.generate(JSON.parse(atr.to_json)))
when atr.kind_of?(String)
values = OpenStruct.new({:node => self.node})
ruby -e 'C=`stty size`.scan(/\d+/)[1].to_i;S=["2743".to_i(16)].pack("U*");a={};puts "\033[2J";loop{a[rand(C)]=0;a.each{|x,o|;a[x]+=1;print "\033[#{o};#{x}H \033[#{a[x]};#{x}H#{S} \033[0;0H"};$stdout.flush;sleep 0.1}'
# This is the CMakeCache file.
# For build in directory: /Users/vadv/Documents/vcmi/build
# It was generated by CMake: /usr/local/Cellar/cmake/2.8.12.1/bin/cmake
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
SELECT DISTINCT `location_district`.`id`,
`location_district`.`name`,
`location_district`.`name_ru`,
`location_district`.`name_en`,
`location_district`.`nameslug`,
`location_district`.`lat`,
`location_district`.`lon`,
`location_district`.`zoom`,
`location_district`.`country_id`,
`location_district`.`region_id`,