Skip to content

Instantly share code, notes, and snippets.

View HFahlstedt's full-sized avatar

Håkan Fahlstedt HFahlstedt

View GitHub Profile
@HFahlstedt
HFahlstedt / project_euler.erl
Last active August 19, 2016 23:55
Project Euler in Erlang
-module(project_euler).
-export([prob1/0, prob2/0, prob3/0, prob4/0, prob5/0, prob6/0, prob7/0, prob8/0, prob9/0]).
prob1() -> lists:sum([X || X <- lists:seq(3, 999), (X rem 3 == 0) or (X rem 5 == 0)]).
prob2_help(A, B, Sum) when (A+B) > 4000000 -> Sum;
prob2_help(A, B, Sum) when (A+B) rem 2 == 0 -> prob2_help(B, A+B, Sum+A+B);
prob2_help(A, B, Sum) -> prob2_help(B, A+B, Sum).
prob2() -> prob2_help(1, 2, 2).
@HFahlstedt
HFahlstedt / otw_bandit0a.sh
Last active January 19, 2018 22:50
OverTheWire Bandit0
ssh -p 2220 bandit0@bandit.labs.overthewire.org
cat readme
ssh -p 2220 bandit0@bandit.labs.overthewire.org 'cat readme'
ssh -p 2220 bandit1@bandit.labs.overthewire.org 'find . -name "-" -exec cat {} \;'
ssh -p 2220 bandit2@bandit.labs.overthewire.org 'find . -name "space*" -exec cat {} \;'
ssh -p 2220 bandit3@bandit.labs.overthewire.org 'cat ./inhere/.hidden'
file inhere/*
ssh -p 2220 bandit4@bandit.labs.overthewire.org 'cat $(file inhere/* | grep ASCII | cut -d: -f1)'
ssh -p 2220 bandit5@bandit.labs.overthewire.org 'cat $(find inhere/ -size 1033c ! -executable -exec file {} \; | cut -d: -f1)'