Skip to content

Instantly share code, notes, and snippets.

@krasnoukhov
krasnoukhov / nginx.log
Created July 23, 2014 14:39
Just posted link on Twitter
46.236.26.102 - - [23/Jul/2014:07:34:16 -0700] "join.hired.com" "GET /x/3WavgA HTTP/1.1" 200 9286 "-" "-" "-" 0.116 0.116 "-"
54.246.137.243 - - [23/Jul/2014:07:34:16 -0700] "join.hired.com" "HEAD /x/3WavgA HTTP/1.1" 200 0 "-" "python-requests/1.2.3 CPython/2.7.2+ Linux/3.0.0-16-virtual" "-" 0.147 0.147 "-"
216.46.190.188 - - [23/Jul/2014:07:34:17 -0700] "join.hired.com" "HEAD /x/3WavgA HTTP/1.1" 200 0 "-" "Google-HTTP-Java-Client/1.17.0-rc (gzip)" "-" 0.127 0.127 "-"
74.112.131.243 - - [23/Jul/2014:07:35:17 -0700] "join.hired.com" "GET /x/3WavgA HTTP/1.1" 200 9284 "-" "Mozilla/5.0 ()" "-" 0.117 0.117 "-"
74.112.131.243 - - [23/Jul/2014:07:36:21 -0700] "join.hired.com" "GET /x/3WavgA HTTP/1.1" 200 9283 "-" "Mozilla/5.0 ()" "-" 0.196 0.196 "-"
185.20.4.220 - - [23/Jul/2014:07:34:16 -0700] "join.hired.com" "GET /x/3WavgA HTTP/1.1" 200 27017 "-" "Mozilla/5.0 (compatible; TweetmemeBot/3.0; +http://tweetmeme.com/)" "-" 0.086 0.086 "-"
199.59.148.209 - - [23/Jul/2014:07:34:16 -0700] "join.hired.com" "GET /x/3WavgA
@krasnoukhov
krasnoukhov / Gemfile
Created April 10, 2014 12:53
sidekiq-middleware and jruby
source "https://rubygems.org"
gem "sidekiq", "~> 2.17.0"
gem "sidekiq-middleware"
@krasnoukhov
krasnoukhov / Gemfile
Last active August 29, 2015 13:57
NPR playlist downloader
source "https://rubygems.org"
gem "ox"
gem "mp3info"
@krasnoukhov
krasnoukhov / heap.json
Last active January 21, 2016 15:17
ObjectSpace.dump_all output
{"address":"0x7f8b8df20628", "type":"STRING", "class":"0x7f8b8a029668", "frozen":true, "embedded":true, "fstring":true, "bytesize":3, "value":"=5F", "encoding":"UTF-8", "flags":{"wb_protected":true, "old":true, "marked":true}}
{"address":"0x7f8b8df20650", "type":"STRING", "class":"0x7f8b8a029668", "frozen":true, "embedded":true, "fstring":true, "bytesize":3, "value":"=3F", "encoding":"UTF-8", "flags":{"wb_protected":true, "old":true, "marked":true}}
{"address":"0x7f8b8df20678", "type":"STRING", "class":"0x7f8b8a029668", "frozen":true, "embedded":true, "fstring":true, "bytesize":3, "value":"=29", "encoding":"UTF-8", "flags":{"wb_protected":true, "old":true, "marked":true}}
{"address":"0x7f8b8df206a0", "type":"STRING", "class":"0x7f8b8a029668", "frozen":true, "embedded":true, "fstring":true, "bytesize":3, "value":"=28", "encoding":"UTF-8", "flags":{"wb_protected":true, "old":true, "marked":true}}
{"address":"0x7f8b8df206c8", "type":"STRING", "class":"0x7f8b8a029668", "frozen":true, "embedded":true, "fstring":tr
upstream balancer {
server app01.yoursite.com:3500 weight=1 max_fails=3;
server app02.yoursite.com:3500 weight=1 max_fails=3;
server app03.yoursite.com:3500 weight=1 max_fails=3;
}
server {
listen 80 default_server;
# Location of our static files
@krasnoukhov
krasnoukhov / config
Created November 4, 2013 20:54
Proper ssh config
# Make it so ssh-ing from one server to another passes keys around automagically
Host *
ForwardAgent yes
# Get rid of SSH connection delays
GSSAPIAuthentication no
# Stop timing out connections
ServerAliveInterval 300
ServerAliveCountMax 20
<link rel="alternate" type="application/rss+xml" href="http://candybox2.net/blog/rss.xml" title="candybox2 blog RSS" />
var jq = document.createElement('script')
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
document.getElementsByTagName('head')[0].appendChild(jq)
setTimeout(function() {
// Stole shekels
setInterval(function() { gibeShekel() }, 10)
// Press random buttons
setInterval(function() {
require "moped"
require "pp"
class Mongochunks
attr_accessor :interval, :config_session, :database_session, :sort_by, :stat
def initialize(config_host: "localhost:27017", host: "localhost:27017", database: "test", sort_by: :total, interval: 1)
self.interval = interval
self.config_session = Moped::Session.new([config_host])
self.config_session.use(:config)
@krasnoukhov
krasnoukhov / parser.rb
Created May 24, 2013 13:52
BIO ENERGY
require "open-uri"
require "nokogiri"
contents = open("http://bio-energy.com.ua/index.php?option=com_marketplace&page=show_category&catid=3&Itemid=0").read
doc = Nokogiri::HTML(contents)
items = doc.css(".jooNormal").map do |item|
{
image: item.css("td").first.css("img").first.attributes["src"].value,
title: item.css("td").first.css("td").at(2).css("a").first.text
}