Skip to content

Instantly share code, notes, and snippets.

Tobias Løfgren tobloef

Block or report user

Report or block tobloef

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View STEM_CTF_2017_Crypto_150.js
const CryptoJS = require("crypto-js");
const emojis = ["🀄","🃏","🅰","🅱","🅾","🅿","🆎","🆑","🆒","🆓","🆔","🆕","🆖","🆗","🆘","🆙","🆚","🇦🇨","🇦🇩","🇦🇪","🇦🇫","🇦🇬","🇦🇮","🇦🇱","🇦🇲","🇦🇴","🇦🇶","🇦🇷","🇦🇸","🇦🇹","🇦🇺","🇦🇼","🇦🇽","🇦🇿","🇦","🇧🇦","🇧🇧","🇧🇩","🇧🇪","🇧🇫","🇧🇬","🇧🇭","🇧🇮","🇧🇯","🇧🇱","🇧🇲","🇧🇳","🇧🇴","🇧🇶","🇧🇷","🇧🇸","🇧🇹","🇧🇻","🇧🇼","🇧🇾","🇧🇿","🇧","🇨🇦","🇨🇨","🇨🇩","🇨🇫","🇨🇬","🇨🇭","🇨🇮","🇨🇰","🇨🇱","🇨🇲","🇨🇳","🇨🇴","🇨🇵","🇨🇷","🇨🇺","🇨🇻","🇨🇼","🇨🇽","🇨🇾","🇨🇿","🇨","🇩🇪","🇩🇬","🇩🇯","🇩🇰","🇩🇲","🇩🇴","🇩🇿","🇩","🇪🇦","🇪🇨","🇪🇪","🇪🇬","🇪🇭","🇪🇷","🇪🇸","🇪🇹","🇪🇺","🇪","🇫🇮","🇫🇯","🇫🇰","🇫🇲","🇫🇴","🇫🇷","🇫","🇬🇦","🇬🇧","🇬🇩","🇬🇪","🇬🇫","🇬🇬","🇬🇭","🇬🇮","🇬🇱","🇬🇲","🇬🇳","🇬🇵","🇬🇶","🇬🇷","🇬🇸","🇬🇹","🇬🇺","🇬🇼","🇬🇾","🇬","🇭🇰","🇭🇲","🇭🇳","🇭🇷","🇭🇹","🇭🇺","🇭","🇮🇨","🇮🇩","🇮🇪","🇮🇱","🇮🇲","🇮🇳","🇮🇴","🇮🇶","🇮🇷","🇮🇸","🇮🇹","🇮","🇯🇪","🇯🇲","🇯🇴","🇯🇵","🇯","🇰🇪","🇰🇬","🇰🇭","🇰🇮","🇰🇲","🇰🇳","🇰🇵","🇰🇷","🇰🇼","🇰🇾","🇰🇿","🇰","🇱🇦","🇱🇧","🇱🇨","🇱🇮","🇱🇰","🇱🇷","🇱🇸","🇱🇹","🇱🇺","🇱🇻","🇱🇾","🇱","🇲🇦","🇲🇨","🇲🇩","🇲🇪","🇲🇫","🇲🇬","🇲🇭","🇲🇰","🇲🇱","🇲🇲","🇲🇳","🇲🇴","🇲🇵","🇲🇶","🇲🇷","🇲🇸","🇲🇹","🇲🇺","🇲🇻","🇲🇼","🇲🇽","🇲🇾","🇲🇿","🇲","🇳🇦","🇳🇨","🇳🇪","🇳🇫","🇳🇬
@tobloef
tobloef / koch_snowflake.py
Created Aug 25, 2017
Generates a Koch snowflake
View koch_snowflake.py
from turtle import Turtle
def drawLine(turtle, size, depth, cur = 1):
if (cur < depth):
drawLine(turtle, size, depth, cur + 1)
turtle.left(60)
drawLine(turtle, size, depth, cur + 1)
turtle.right(120)
drawLine(turtle, size, depth, cur + 1)
turtle.left(60)
@tobloef
tobloef / wordsplitter.cs
Created Aug 25, 2017
Inspired by a classic programming interview question, this C# program will take an input string and split it into a string of space-seperated words from a dictionary. "Applepieplate" will for example split into "apple pie plate". I've implemented two versions of this program, one that uses a string array as a dictionary and one that uses a trie.…
View wordsplitter.cs
using System;
using System.Collections.Generic;
using System.Linq;
class MainClass {
// The dictionary to check the words against. Normally this would be loaded from a file.
// If the dictionary is too big, loading it directly from the file into a trie would be better.
private static HashSet<string> dictSet = new HashSet<string>() {
"all",
"base",
@tobloef
tobloef / main.js
Last active Aug 25, 2017
Solver for the Riddler's Legacy 2 challenge
View main.js
const { Socket } = require("net");
const { StringDecoder } = require("string_decoder");
const solve = require("./solve.js");
const ip = "192.168.200.234";
const port = 2224;
const client = new Socket();
client.on("connect", connectHandler);
client.on("data", dataHandler);
@tobloef
tobloef / main.js
Last active Aug 25, 2017
Trustpilot Backend Challenge Solution
View main.js
/**
* Code for the Trustpilot backend challenge.
*
* This program will perform a type of dictionary attack against a list of MD5 hashes. An anagram of the hashed strings are know, which reduces the search space greatly.
*
* After the program has run, the following secret phrases will have been found:
* Easy secret phrase: printout stout yawls
* Medium secret phrase: ty outlaws printouts
* Hard secret phrase: wu lisp not statutory
*/
@tobloef
tobloef / IsPalindromeAndSquare.js
Last active Aug 25, 2017
Finds numbers that are both palindromes and squares
View IsPalindromeAndSquare.js
'use strict';
function findPalinSquare(n) {
let nextRoot = Math.ceil(Math.sqrt(n + 1));
while (true) {
const nextSquare = nextRoot * nextRoot;
if (isPalin(nextSquare)) {
return nextSquare;
}
nextRoot++;
}
You can’t perform that action at this time.