Skip to content

Instantly share code, notes, and snippets.

View kovyrin's full-sized avatar

Oleksiy Kovyrin kovyrin

View GitHub Profile
@philandstuff
philandstuff / scale-summit.org
Last active August 29, 2015 13:57
scale-summit 2014

Scale Summit 2014

Intro, MBS

ideas for sessions

  • bootstrapping environments (without object stores)
  • service discovery
  • removing spofs
#include <stdio.h>
#include <sys/select.h>
#include <fcntl.h>
#include <stdlib.h>
int main(int argc, char ** argv) {
char * dev_short = (argc > 1) ? argv[1] : "sda1";
char dev[512];
snprintf(dev, sizeof(dev), "/sys/block/%s/size", dev_short);
#!/bin/sh
# Set up an ssh tunnel to our proxy server + socks5 proxy endpoint at 127.0.0.1:1080
ssh -D 1080 -N -c blowfish -f proxy.local
@kpumuk
kpumuk / mysql_adapter_extensions.rb
Created April 15, 2011 17:24
Trace SQL queries in Rails 2
module OpsApi
# Helper methods for `ActiveRecord::ConnectionAdapters::MysqlAdapter` to enable SQL queries
# tracing functionality. There are two goals:
#
# * Add source line into the query itself so it would be possible to understand where
# the query was issues from:
#
# SELECT * FROM `admins` WHERE
# ((`admins`.`user_id` = 1)) LIMIT 1
# /*OOPS:app/models/user.rb:72:in `admin?'*/
@Flamefork
Flamefork / ffmpeg.rb
Created December 27, 2011 22:21
ffmpeg & carrierwave
module CarrierWave
module FFMPEG
extend ActiveSupport::Concern
module ClassMethods
def faststart
process :faststart => true
end
def transcode options
@kovyrin
kovyrin / ruby-1.8.7-hash-randomize.patch
Created December 29, 2011 18:51
Ruby EE 2011.03 Hash Collision Fix
From 4f69a748ab820c6a8bd204f94d13d970847f575c Mon Sep 17 00:00:00 2001
From: RPM Builder <rpmbuild@livingsocial.com>
Date: Thu, 29 Dec 2011 19:48:52 +0000
Subject: [PATCH] Backport randomized hash patch from upstream
---
source/inits.c | 4 ++
source/random.c | 74 ++++++++++++++++++++++++++++++---------
source/st.c | 14 +++++++-
source/string.c | 7 +++-
@RISCfuture
RISCfuture / rails_template.rb
Last active September 30, 2015 20:27
Tim's Awesome Rails Template
# encoding: utf-8
require 'open3'
def rvm_env(cmd)
Open3.popen3 "bash -c 'source ~/.rvm/scripts/rvm && #{cmd}'" do |stdin, stdout, stderr, thread|
thread.join
end
end

db-charmer

The Problem

If you're unfamiliar with the issue, there is an intermittent failure when running Capybara tests on any machine (spec/requests/ or features/):

undefined method `db_charmer_connection_name' for #<ActiveRecord::ConnectionAdapters::Mysql2Adapter:0x00000009f16ec8>
/var/lib/jenkins/.rvm/gems/ruby-1.9.3-p0/gems/db-charmer-1.7.0/lib/db_charmer/active_record/class_attributes.rb:85:in `db_charmer_remapped_connection'
@leinaddm
leinaddm / dell_soap_check.py
Created February 23, 2012 14:18
dell warranty check
#!/usr/bin/python
# Daniel De Marco - ddm@didiemme.net - 2012-02-23
# suds from https://fedorahosted.org/suds/
import suds
import sys
def get_warr(svctag):