This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class DockerAttacher | |
attr_reader :docker_container | |
def initialize(docker_container) | |
if docker_container.nil? | |
puts "Usage: dock [container_id]\nGet container id with `docker ps`" | |
else | |
@docker_container = docker_container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@data = File.read("./input.txt").split("\n").map{|n| n.split(": ").map(&:to_i)}.to_h | |
@firewall = Array.new(99) | |
@firewall = @firewall.each_with_index.map{|n,i| next if @data[i].nil?; ((0..@data[i]-1).to_a + (1..@data[i]-2).to_a.reverse).cycle} | |
@results = (0..98).map{|n| n if @firewall.map{|e| next if e.nil?; e.next}[n] == 0}.select{|n| n if !n.nil?} | |
@severity = @results.map{|i| i * @data[i]}.inject(&:+) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
require 'minitest/emoji' | |
class Version | |
def self.next_version version | |
next_version_3 version | |
end | |
def self.next_version_1 version | |
number_as_string = version.split(".").join('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| | |
|oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| | |
|oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| | |
|oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| | |
|oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| | |
|ooooooooooooooooooooooooooooooooooooooooooooo+:::++o::+++++ooooooooooooooooooooooooooooooooooooooooo| | |
|oooooooooooooooooooooooooooooooooooooooooooo:::::::+o+:::::+::+++ooooooooooooooooooooooooooooooooooo| | |
|ooooooooooooooooooooooooooooooooooooooooooo::::::::::o+:+::::::::::++ooooooooooooooooooooooooooooooo| | |
|oooooooooooooooooo+~~::::+++oooooooooooooo::::::::::::o+::::+:::::::::+ooooooooooooooooooooooooooooo| | |
|ooooooooooooooooooo.~~~.~.~~~~~~::::ooooo:~::::::::::~+o+::::::::::::::+oooooooooooooooooooooooo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
.:iir:, | |
:iYu111u2YLjYiri | |
..iLUU5qOMMOOEZXX15uuJ21uvqjJ7i. | |
.:7J5FN0OGMOMZZEZE0PPSSFF1551ujYJYuY72U7v7vrr:. | |
:2EMOM8OZZ0NPXSF1S5k5FU1uUU1u2U12UJJLjJYv2uv7L7rrvLv: | |
.UMM0qSS111S15U521u1U1uUuUuUU2u2U1u2u15uLLv. 7Li vv7ir;vL7: | |
:5OGS212511U51125UUuuU2u2UUU22Fu225152Sr:ir7,. ,@B7 rv7rri;r77;. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb | |
1.9.3p194 :001 > ip2 = '206.214.251.' | |
=> "206.214.251." | |
1.9.3p194 :002 > (0..254).each{|octet| x= `nslookup #{ip2}#{octet}`.match(/\tname = (.*)/); puts x.captures.first unless x.nil? } | |
Episode.IV. | |
A.NEW.HOPE. | |
It.is.a.period.of.civil.war. | |
Rebel.spaceships. | |
striking.from.a.hidden.base. | |
have.won.their.first.victory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
λ ls -al | |
total 0 | |
drwxr-xr-x 14 pcrissman staff 476 Mar 21 15:42 . | |
drwxr-xr-x 9 pcrissman staff 306 Mar 21 15:38 .. | |
-rw-r--r-- 1 pcrissman staff 0 Mar 21 15:38 Appfile | |
-rw-r--r-- 1 pcrissman staff 0 Mar 21 15:42 Configfile | |
-rw-r--r-- 1 pcrissman staff 0 Mar 21 15:38 Docfile | |
-rw-r--r-- 1 pcrissman staff 0 Mar 21 15:42 Featurefile | |
-rw-r--r-- 1 pcrissman staff 0 Mar 21 15:38 Filefile | |
-rw-r--r-- 1 pcrissman staff 0 Mar 21 15:38 Gemfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** Lion Users: Xcode Version 4.2.x for OS X Lion works only for ruby 1.9.3-p0 (or higher). | |
It currently fails to build several other rubies and gems, as well as several Homebrew and | |
Macports packages. Xcode Version 4.1 (4B110) works. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveMerchant | |
module Billing | |
class CreditCard | |
extend ActiveModel::Naming | |
include ActiveModel::Conversion | |
def persisted? | |
false | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> # on a model, works fine. | |
> Voucher.destroy_all(:user_id => nil) | |
=> # works as expected; returns an array of the records it destroyed, and said records have been deleted. | |
> # on a collection: | |
> wv.voucher_restrictions.destroy_all(:restriction_id => 108) | |
=> ArgumentError: wrong number of arguments (1 for 0) | |
> # but... this works: | |
> wv.voucher_restrictions.where(:restriction_id => 108).destroy_all |
NewerOlder