Skip to content

Instantly share code, notes, and snippets.

View koenkarsten's full-sized avatar
🔧

Koen Karsten koenkarsten

🔧
View GitHub Profile
@koenkarsten
koenkarsten / Server.scala
Last active April 24, 2024 13:37
A simple TCP Socket Server made with Scala + Akka IO
import java.net.InetSocketAddress
import akka.actor.{ActorSystem, Props, Actor}
import akka.io.{Tcp, IO}
import akka.io.Tcp._
import akka.util.ByteString
class TCPConnectionManager(address: String, port: Int) extends Actor {
import context.system
IO(Tcp) ! Bind(self, new InetSocketAddress(address, port))
import java.time.Instant
import io.getquill.{MappedEncoding, LowerCase, MySQLDialect, JdbcContext}
import io.getquill.context.sql.SqlContext
import java.util.Date
trait Encoders {
implicit val instantEncoder = MappedEncoding[Instant, Date](i => Date.from(i))
}
trait Decoders {
@koenkarsten
koenkarsten / gist:7c82414b63f86856269ca2b4c466c100
Last active July 17, 2017 13:53 — forked from Frozenfire92/gist:3627e38dc47ca581d6d024c14c1cf4a9
Install Scala and SBT using apt-get on Ubuntu 16.04 or any Debian derivative using apt-get
## Java
sudo apt-get update
sudo apt-get install apt-transport-https default-jdk
## Scala
sudo apt-get remove scala-library scala
sudo wget http://scala-lang.org/files/archive/scala-2.12.1.deb
sudo dpkg -i scala-2.12.1.deb
sudo apt-get update
sudo apt-get install scala
@koenkarsten
koenkarsten / Vagrantfile
Last active August 28, 2018 12:21
RabbitMQ Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 5672, host: 5672
config.vm.network "forwarded_port", guest: 15672, host: 15672
config.vm.provision "shell", inline: <<-SHELL
wget -O - 'https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc' | sudo apt-key add -
echo "deb https://dl.bintray.com/rabbitmq/debian trusty main" | sudo tee
apt-get update
apt-get install -y erlang rabbitmq-server
@koenkarsten
koenkarsten / swagger-yaml-to-html.py
Created April 25, 2019 07:26 — forked from oseiskar/swagger-yaml-to-html.py
Converts Swagger YAML to a static HTML document (needs: pip install PyYAML)
#!/usr/bin/python
"""
Usage:
python swagger-yaml-to-html.py < /path/to/api.yaml > doc.html
"""
import yaml, json, sys
TEMPLATE = """
@koenkarsten
koenkarsten / README-Template.md
Last active May 3, 2019 15:05 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here.

Build Status

If possible include an indication about the build status of the project here, a badge per environment would be sufficient.

Prerequisites

Git (example)

brew install git
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class TestDataGenerator {
public static void main(String[] args) {
int maxSize = 100;
int counter = 0;
@koenkarsten
koenkarsten / Dockerfile
Last active March 27, 2023 14:21
SRT Live Transmit
# Preperations
FROM debian:11
WORKDIR /tmp
RUN apt-get update
RUN apt-get install -y \
git=1:2.30.2-1 \
libssl-dev=1.1.1n-0+deb11u4 \
tclsh \
pkg-config=0.29.2-1 \
cmake=3.18.4-2+deb11u1 \