Skip to content

Instantly share code, notes, and snippets.

Avatar

Dmitry Krasnoukhov krasnoukhov

View GitHub Profile
@krasnoukhov
krasnoukhov / nginx.log
Created Jul 23, 2014
Just posted link on Twitter
View nginx.log
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 Apr 10, 2014
sidekiq-middleware and jruby
View Gemfile
source "https://rubygems.org"
gem "sidekiq", "~> 2.17.0"
gem "sidekiq-middleware"
@krasnoukhov
krasnoukhov / Gemfile
Last active Aug 29, 2015
NPR playlist downloader
View Gemfile
source "https://rubygems.org"
gem "ox"
gem "mp3info"
@krasnoukhov
krasnoukhov / heap.json
Last active Jan 21, 2016
ObjectSpace.dump_all output
View heap.json
{"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
View yoursite.conf
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 Nov 4, 2013
Proper ssh config
View 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
View index.html
<link rel="alternate" type="application/rss+xml" href="http://candybox2.net/blog/rss.xml" title="candybox2 blog RSS" />
View player.js
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() {
View mongochunks.rb
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)
View parser.rb
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
}
You can’t perform that action at this time.