Skip to content

Instantly share code, notes, and snippets.

@timmolderez
timmolderez / slack_export_by_user.py
Last active February 5, 2021 18:10
Slack - generate a wordcloud per user from a Slack chat export
"""
Restructures Slack chat export files so that the messages are now grouped per user
(normally the export is grouped per channel)
Not actually useful or anything :) Mainly just for fun so you can generate a
wordcloud per user, then play the "guess whose wordcloud is this?"-game
Usage: fill in INPUT_DIR and OUTPUT_DIR, then run the script..
- See this R script to create wordclouds from a chat export:
"1_3" \
"__2" |
"_00" |=> filter "000": output = {"_00", "0__", "00_"}
"_1_" |
"0__" |=> filter "123": output = {"1_3", "_2_", "1__"}
"_2_" |
"_01" |=> filter "__0": output = {"_00", "_1_", "0__", "_2_", "1__", "00_", "_20", "1_0"}
"1__" |
"00_" |=> filter "10_": output = {"1_3", "__2", "_00", "_01", "1__", "1_1", "_03", "1_2", "1_0"},
"1_1" |
@timmolderez
timmolderez / DrawRectangleTest.scala
Created October 24, 2018 21:24
Software engineering - TestFX example
package de.thm.move
import java.awt.{MouseInfo, Robot}
import javafx.scene.input.{KeyCode, MouseButton}
import org.junit.Test
import org.junit.Assert._
class DrawRectangleTest extends GuiTest {
@timmolderez
timmolderez / ArithmeticParser.scala
Created November 27, 2017 18:24
Design patterns exercise: composite, iterator, visitor
import java.util
import ArithmeticParser.{BinaryOperators, Parentheses}
import ArithmeticParser.BinaryOperators.BinaryOperator
import scala.util.control.Breaks._
object ArithmeticParser {
object Parentheses extends Enumeration {
@timmolderez
timmolderez / SandwichShop.scala
Created November 27, 2017 15:51
Design patterns exercise: decorator, simple factory
object SandwichShop {
trait Sandwich {
def getPrice: Double
def getIngredients: Array[String]
}
class CheeseSandwich extends SandwichShop.Sandwich {
override def getPrice = 2
override def getIngredients: Array[String] = Array[String]("bread", "cheese")
@timmolderez
timmolderez / Calculator.scala
Last active November 22, 2017 14:21
Design patterns exercise (command)
import java.awt.Dimension
import scala.swing.BorderPanel.Position
import scala.swing.event.ButtonClicked
import scala.swing.{BorderPanel, Button, GridPanel, MainFrame, TextField}
object Calculator {
def main(args: Array[String]): Unit = {
val frame = new MainFrame() {
@timmolderez
timmolderez / Clock.scala
Last active November 22, 2017 12:08
Design patterns exercise (observer + strategy)
import java.text.SimpleDateFormat
import java.util.Date
object Clock {
val TIME_24 = 0
val TIME_US = 1
val TIME_UNIX = 2
def main(args: Array[String]): Unit = {
val c = new Clock
@timmolderez
timmolderez / TextEd.scala
Last active October 12, 2017 08:47
Initial code of the Swing text editor exercise
import scala.swing._
import scala.swing.BorderPanel.Position
class TextEd extends MainFrame {
// Window title
title = "Swing text editor"
// Window size
preferredSize = new Dimension(640, 480)
@timmolderez
timmolderez / Launcher.java
Created December 14, 2016 15:50
Modified version of Launcher.java to be used in the mock testing exercises
package nl.tudelft.jpacman;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import com.google.java.contract.Ensures;
import com.google.java.contract.Invariant;
import com.google.java.contract.Requires;
@timmolderez
timmolderez / SandwichShop.java
Created December 8, 2016 00:39
Design patterns exercise: decorator, simple factory
package be.ac.vub.patterns;
public class SandwichShop {
public static interface Sandwich {
public double getPrice();
public String[] getIngredients();
}
public static class CheeseSandwich implements Sandwich {