Skip to content

Instantly share code, notes, and snippets.

View ixti's full-sized avatar
😂
forever blowing bubbles

Alexey Zapparov ixti

😂
forever blowing bubbles
View GitHub Profile
@ixti
ixti / echo.ru
Last active August 29, 2015 14:02
Tiny echo-server I use to investigate OAuth callback responses :D
require "erb"
begin
require "awesome_print"
rescue LoadError
puts "Install Awesome Print first:"
puts
puts " gem install awesome_print"
puts
exit 1
@ixti
ixti / README.md
Last active August 29, 2015 14:02
Ruby data inliner

Usage

require "yaml"
require "__data__"

class Status
  REASONS = YAML.load __DATA__
end
@ixti
ixti / foo.js
Last active August 29, 2015 14:01
var suite = new (require("benchmark").Suite);
var stoper = '<~_#@!';
var stoperRE = /<~_#@!/g;
function format(msg, arg) {
return msg + ":" + arg;
}
function varify_puzrin(phrase, params) {
Authenticated to localhost ([::1]:22222).
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
/usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.9.2/lib/mongo/util/pool.rb:119:in `ping_time'
/usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.9.2/lib/mongo/util/read_preference.rb:119:in `block in select_near_pool'
/usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.9.2/lib/mongo/util/read_preference.rb:119:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.9.2/lib/mongo/util/read_preference.rb:119:in `min_by'
/usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.9.2/lib/mongo/util/read_preference.rb:119:in `select_near_pool'
/usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.9.2/lib/mongo/util/read_preference.rb:114:in `select_secondary_pool'
/usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.9.2/lib/mongo/util/read_preference.rb:92:in `select_pool'
/usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.9.2/lib/mongo/util/read_preference.rb:67:in `read_pool'
/usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.9.2/lib/mongo/mongo_replica_set_client.rb:360:in `block in checkout_reader'
/usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.9.2/lib/mongo/mongo_replica_set_clie
@ixti
ixti / headers.rb
Last active August 29, 2015 13:56
require 'set'
class HTTP::Headers
def initialize
@pile = []
@keys = Set.new
end
def set(name, value)
delete(name)
@ixti
ixti / trap_chain.rb
Created February 26, 2014 17:04
Chained trap in Ruby
module Kernel
def chained_trap(signal, &block)
oldproc = trap signal do |*args|
block[*args] do
trap signal, oldproc
Process.kill signal, 0
end
end
end
end
@ixti
ixti / mongo-shell.log
Created January 26, 2014 16:11
MongoDB, are you serious???
% mongo
MongoDB shell version: 2.4.2
connecting to: test
> db.t1.ensureIndex({ username: 1 }, { sparse: true });
> db.t1.find({ deleted_at: { $exists: false }, username: "foo" }).explain()
{
"cursor" : "BasicCursor",
"isMultiKey" : false,
"n" : 0,
"nscannedObjects" : 3,
@ixti
ixti / 001.out
Last active January 3, 2016 19:39
curl -v -L http://ixti.net
* Rebuilt URL to: http://ixti.net/
* Hostname was NOT found in DNS cache
* Adding handle: conn: 0x1210c50
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1210c50) send_pipe: 1, recv_pipe: 0
* Trying 204.232.175.78...
* Connected to ixti.net (204.232.175.78) port 80 (#0)
@ixti
ixti / thin.patch
Last active January 2, 2016 10:39
--- a/lib/thin/server.rb 2014-01-06 23:53:11.517120396 +0100
+++ b/lib/thin/server.rb 2014-01-06 23:54:18.549990835 +0100
@@ -207,6 +207,17 @@
def running?
@backend.running?
end
+
+ def log_backtrace
+ Thread.list.each do |thread|
+ log "Thread TID-#{thread.object_id.to_s(36)} #{thread['label']}"