Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block advorak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View openssl.rb
#!/usr/bin/env ruby
# I am trying to replicate the successful connection granted by issuing the following command:
# openssl s_client -dtls1 -cipher DHE-DSS-AES256-SHA -connect
require 'socket'
require 'openssl'
View gist:ec229c08750cc4ca660f
#!/usr/bin/env ruby
require 'socket'
require 'openssl'
socket ='', 34135)
ssl_context =
ssl_socket =, ssl_context)
ssl_socket.sync_close = true
View sample_script.rb
u = User.create
id =
# The above should and does essentially do u.sessions.create()
# I expect after initializing this for it to test !session_valid? == false && !new_record? == false
u = User.find(id)
# I expect after initializing this for it to test !session_valid? == false && !new_record? == false
View udata.rb
# I am executing a program 'umessage' and piping output to this
# ruby script ...
# The problem is that I'm noticing my program isn't receiving all
# of the output I expect it to receive from STDOUT to STDIN......
# It is consistently skipping data... any hints as to what I'm
# doing wrong?
DEBUG = true
@current_data = ''
while(data = @current_data.to_s +
@current_data = ''
messages = data.lines.slice_before(/^\d{2}\/\d{2}/).collect(&:join)
messages.each do |message|
if message.join.match(/\n$/)
UnimaticMessage.create user_id: ENV['DB_USER_ID'], data: message
View cards_controller.rb
class CardsController
def create
render params.inspect
# Submitted, this yields:
# { "cards" => [ { "black" => ["Edit this new black card text..."] } ] }
# I want to yield this:
advorak / andy.rb
Last active Aug 29, 2015
is it appropriate in a class, for a getter method of an instance variable which happens to be an array, to dup the variable so that such things as getter#push cannot be called on them?
View andy.rb
class Andy
def initialize
@andytest = []
attr_reader :andytest
View wordpress_connection_users.rb
require 'active_support/all'
require 'active_record'
class WordpressConnection < ActiveRecord::Base
WordpressConnection.establish_connection adapter: 'mysql2', username: 'root', password: 'password', host: 'localhost', database: 'wordpress_wordpress'
class WordpressConnection::User < WordpressConnection
self.table_name = 'wp_users'
View demoappGemfile
source ''
ruby '2.0.0'
gem 'rails', '4.0.4'
group :development do
gem 'sqlite3', '1.3.8'
View test.rb
require 'active_support/all'
module Asdf
def, options)
classified_connection_name = connection_name.to_s.classify
self.class_eval <<-EOF
class #{classified_connection_name}
%w(aaa bbb ccc ddd).each do |letters|
class #{letters.classify} < #{classified_connection_name}
You can’t perform that action at this time.