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
require 'minitest/autorun' | |
class Bloom | |
attr_accessor :array | |
def initialize(array_size=10_000_000, hashes_per_word=4, words_file="/usr/share/dict/words") | |
@array_size = array_size | |
@hashes_per_word = hashes_per_word | |
@words_file = words_file |
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
/* | |
Objects can have the following parameters: | |
color: '#fff' by default | |
impassable: true if it blocks the player from movement (false by default) | |
onCollision: function (player, game) called when player moves over the object | |
onPickUp: function (player, game) called when player picks up the item | |
symbol: Unicode character representing the object | |
type: 'item' or null | |
*/ |
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
/***************** | |
* bossFight.js * | |
***************** | |
* | |
* NO FARTHER, DR. EVAL!!!! | |
* YOU WILL NOT GET OUT OF HERE ALIVE!!!! | |
* IT'S TIME YOU SEE MY TRUE FORM!!!! | |
* FACE MY ROBOT WRATH!!!!! | |
*/ |
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
/**************************** | |
* documentObjectMadness.js * | |
**************************** | |
* | |
* I can't believe it! I can't believe you made it onto | |
* Department of Theoretical Computation's web server! | |
* YOU SHOULD HAVE BEEN DELETED! This shouldn't even be | |
* possible! What the hell were the IT folks thinking? | |
* | |
* No matter. I still have the Algorithm. That's the |
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
/********************** | |
* superDrEvalBros.js * | |
********************** | |
* | |
* You're still here?! Well, Dr. Eval, let's see | |
* how well you can operate with one less dimension. | |
* | |
* Give up now. Unless you have a magic mushroom | |
* up your sleeve, it's all over. | |
*/ |
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
/*************** | |
* pointers.js * | |
*************** | |
* | |
* You! How are you still alive? | |
* | |
* Well, no matter. Good luck getting through this | |
* maze of rooms - you'll never see me or the Algorithm again! | |
*/ |
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
/************* | |
* lasers.js * | |
************* | |
* | |
* Time to unleash the killer lasers! Each laser will kill you | |
* unless you have the appropriate color. Too bad you can't | |
* see which color corresponds to which laser! | |
*/ | |
function getRandomInt(min, max) { |
NewerOlder