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
# This builds a publicly available SSH server on EC2. | |
# | |
# Make sure to edit the path to your public SSH key. | |
# | |
# Log in: | |
# | |
# $ ssh ubuntu@$(terraform output -raw public_ip) | |
terraform { | |
required_providers { |
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 "nokogiri" | |
require "open-uri" | |
require "optparse" | |
require "set" | |
MAX_DEPTH = 2 | |
class Page | |
def initialize(body:, url:) | |
@body = body |
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 "rspec/autorun" | |
# An implementation of an immutable binary search tree in Ruby, with a small | |
# suite of tests. Supports #==, #insert, #delete, and #to_a (an in-order | |
# traversal). | |
# | |
# To run the tests, just evaluate the file: `ruby binary_search_tree.rb` | |
class Leaf | |
def ==(other) |
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
# Supposing that you're starting on the master branch... | |
# Create a new branch and switch to it: | |
git checkout -b my-work | |
# Commit your changes on that branch: | |
git add . | |
git commit -m "My work so far!" | |
# Update the master branch: |
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
int even_sum = 0; | |
int input = 0; | |
bool is_even = false; | |
cin >> input; | |
while (input > 0) { | |
is_even = ! (input % 2); | |
if (is_even) { |
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 | |
# Because sometimes you need a script that generates a random | |
# Github-compatible emoji. | |
emoji = %w{+1 -1 100 1234 8ball a ab abc abcd accept aerial_tramway | |
airplane alarm_clock alien ambulance anchor angel anger angry | |
anguished ant apple aquarius aries arrow_backward arrow_double_down | |
arrow_double_up arrow_down arrow_down_small arrow_forward | |
arrow_heading_down arrow_heading_up arrow_left arrow_lower_left |
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
#include <stdio.h> | |
main(t,_,a) | |
char *a; | |
{ | |
return!0<t?t<3?main(-79,-13,a+main(-87,1-_,main(-86,0,a+1)+a)): | |
1,t<_?main(t+1,_,a):3,main(-94,-27+t,a)&&t==2?_<13? | |
main(2,_+1,"%s %d %d\n"):9:16:t<0?t<-72?main(_,t, | |
"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#\ | |
;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l \ | |
q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;#\ |
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 MessageDispatcher | |
def initialize | |
@observers = [] | |
end | |
def register(observer) | |
@observers << observer | |
end | |
def dispatch(message) |
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 UnixProcess | |
attr_reader :uid, :pid, :ppid, :cmd | |
def initialize(uid:, pid:, ppid:, cmd:) | |
@uid = uid | |
@pid = pid | |
@ppid = ppid | |
@cmd = cmd |
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 SayRepl | |
attr_reader :voice | |
def initialize(voice) | |
@voice = voice | |
end | |
def go |
NewerOlder