Skip to content

Instantly share code, notes, and snippets.

@lkallas
lkallas / mooncascade_secret_message.js
Created June 6, 2019 06:41
Mooncascade secret message solution.
const msg = [125, 66, 69, 10, 67, 89, 10, 94, 66, 79, 10, 75, 95, 94, 66, 69, 88, 10, 69, 76, 10, 8, 126, 66, 79, 10, 98, 67, 94, 73, 66, 66, 67, 65, 79, 88, 13, 89, 10, 109, 95, 67, 78, 79, 10, 94, 69, 10, 94, 66, 79, 10, 109, 75, 70, 75, 82, 83, 8, 21, 10, 122, 70, 79, 75, 89, 79, 10, 89, 79, 68, 78, 10, 83, 69, 95, 88, 10, 75, 68, 89, 93, 79, 88, 10, 94, 69, 10, 64, 69, 72, 89, 106, 71, 69, 69, 68, 73, 75, 89, 73, 75, 78, 79, 4, 73, 69, 71, 6, 10, 93, 67, 94, 66, 10, 83, 69, 95, 88, 10, 105, 124, 10, 69, 88, 10, 102, 67, 68, 65, 79, 78, 99, 68, 10, 127, 120, 102, 4];
let message = '';
for (const charcode of msg) {
message += String.fromCharCode(charcode ^ 42);
}
console.log(message); // Who is the author of "The Hitchhiker's Guide to the Galaxy"? Please send your answer to jobs@mooncascade.com, with your CV or LinkedIn URL.
// Answer: Douglas Adams (source: https://en.wikipedia.org/wiki/The_Hitchhiker%27s_Guide_to_the_Galaxy)

Keybase proof

I hereby claim:

  • I am lkallas on github.
  • I am lkallas (https://keybase.io/lkallas) on keybase.
  • I have a public key whose fingerprint is F4ED 63BD C3B5 7CC5 70DA 0958 F472 3FE2 02D7 CC5E

To claim this, I am signing this object:

@lkallas
lkallas / calculator.php
Last active May 3, 2019 15:41
Solution for Astro Baltics on-site test-assignment that must be solved in 1-2 hours.
<?php
function calculateWorkingHours(string $workStartTime, string $workEndTime, string $dayStartTime = '06:00', string $dayEndTime = '22:00'): array
{
$dateTime = DateTime::createFromFormat('H:i', $workStartTime);
$timeCursor = $dateTime->format('H:i');
$interval = new DateInterval('PT15M');
$dayUnits = $nightUnits = 0;
do {
@lkallas
lkallas / URLcompare.java
Created April 27, 2016 11:18
Small JAVA class for comapring URL-s.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* Simple class for comparing URL-s with HTTP/HTTPS protocol.
*
* @author Lennar Kallas
*/