Skip to content

Instantly share code, notes, and snippets.

View fredlahde's full-sized avatar
😁
Hey there!

Fred Lahde fredlahde

😁
Hey there!
View GitHub Profile
@fredlahde
fredlahde / Main.java
Last active April 18, 2016 18:30
MySQL Async Queue
package de.fr3d63.main;
import de.fr3d63.mysql.Queue;
import org.bukkit.plugin.java.JavaPlugin;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Main extends JavaPlugin {
import java.util.Collection;
import java.util.HashSet;
class TestKlasse {
public TestKlasse() {
}
}
interface Buildable<T> {
void build(int x, Collection<T> c);
@fredlahde
fredlahde / httpget.swift
Last active March 16, 2017 21:37
Basic async http get in swift with closure
import PlaygroundSupport
import Foundation
func get(with: String ,callback: @escaping (_ data : [String : Any], _ succes : Bool) -> Void) -> Void {
let url = URL(string: with)
let task = URLSession.shared.dataTask(with: url!) { data, response, error in
guard error == nil else {
package com.example.demo
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.context.annotation.Bean
import org.springframework.data.annotation.Id
import org.springframework.data.repository.reactive.ReactiveCrudRepository
import org.springframework.stereotype.Component
import org.springframework.web.reactive.function.server.ServerRequest
import org.springframework.web.reactive.function.server.ServerResponse
@fredlahde
fredlahde / http.swift
Last active September 30, 2017 11:41
HTTP in swift 3 + 4
import UIKit
import PlaygroundSupport
import Foundation
// GET Request
let url = URL(string: "https://httpbin.org/ip")
let getTask = URLSession.shared.dataTask(with: url!) { data, response, error in
guard error == nil else {
print(error!)
@fredlahde
fredlahde / main.go
Created December 14, 2017 19:18
GPL License Inserter
/*
* This file is part of the XXX distribution (https://github.com/xxxx or http://xxx.github.io).
* Copyright (c) 2015 Liviu Ionescu.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@fredlahde
fredlahde / docker-setup.sh
Last active January 7, 2018 12:03
Docker & Docker Compose Ubuntu 17.10
#!/bin/bash
# docker
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
@fredlahde
fredlahde / IVKeystream.txt
Last active April 3, 2018 18:33
Keystream parser
Hinweis IV:050607 bedeutet IV[0]=05,IV[1]=06,IV[2]=07
IV: 02 01 C4 Schlüsselstrom: 02
IV: 03 01 C4 Schlüsselstrom: F8
IV: 03 FF 15 Schlüsselstrom: E0
IV: 03 FF 78 Schlüsselstrom: 54
IV: 02 01 A3 Schlüsselstrom: FC
IV: 02 01 F3 Schlüsselstrom: 73
IV: 03 FF 99 Schlüsselstrom: AA
IV: 02 01 0C Schlüsselstrom: CD
IV: 02 01 43 Schlüsselstrom: A1
import org.junit.Test;
public class NextDateTest {
@Test
public void it_runs_correct_for_valid_date_in_a_leap_year() {
String[] testInput = new String[]{"29", "02", "2020"};
StdOutAsserter.assertAgainstStdOut(NextDate::main, testInput, s -> s.equals("Morgen ist der 1 . 3 . 2020\n"));
}
@Test
@fredlahde
fredlahde / main.go
Created July 6, 2018 22:04
Google Interview Questions - Aarray Multiplicator
package main
import "fmt"
/**
* There is an array A[N] of N numbers.
* You have to compose an array Output[N] such that Output[i]
* will be equal to multiplication of all the elements of A[N] except A[i].
* For example Output[0] will be multiplication of A[1] to A[N-1]
* and Output[1] will be multiplication of A[0] and from A[2] to A[N-1].