Skip to content

Instantly share code, notes, and snippets.

View larsgroeber's full-sized avatar

Lars Gröber larsgroeber

View GitHub Profile
@larsgroeber
larsgroeber / hashing.sh
Last active September 19, 2016 20:51
Get elapsed time for hashing
#! /bin/bash
max=1000
cmd="sha256sum -"
blob="dsahgjkasgktaskgk"
endCmd=""
for (( i=1; i<=$max; i++ ))
do
endCmd=${endCmd}"echo ${blob}$i | $cmd;"
@larsgroeber
larsgroeber / gnuplot_sample.gp
Last active October 15, 2016 16:40
Small sample gnuplot file for plotting a sine-curve
#! /bin/gnuplot
# small sample script to be extended for any project
set terminal wxt size 350,262 enhanced font 'Verdana,10' persist
# Line width of the axes
set border linewidth 1.5
# Line styles
#! /bin/gnuplot
set terminal wxt size 350,262 enhanced font 'Verdana,10' persist
# set terminal dumb
file="`echo $plot_file`" # make sure to set the $plot_file environment variable first
f(x) = a*x+b
a = 1
b = 1
fit f(x) file via a,b
@larsgroeber
larsgroeber / spamMail.sh
Last active January 28, 2021 20:14
Small bash script for sending spam mails using mutt
#! /usr/bin/env bash
#
# small script to send spam mails using mutt (excercise project for a course)
# @author: Lars Groeber
#
# Usage:
# SCRIPTNAME [-T %Y%m%d%H%M] [-t timeInterval-in-min] [-m maxMails]
# (-s subject,email,body) | (-f subject,file-with-emails,body)
#
#!/bin/bash
#
# This script watches the local folder for files with the ending in 'file_endings'
# and uploads them to a server specified in 'server'.
#
server_name="" # include login name if necessary
target_directory=""
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
@larsgroeber
larsgroeber / anagram_finder.cpp
Created October 6, 2017 14:20
Small anagram finder in c++. Generates a hash table from a dictionary file of words.
/**
* \author Lars Gröber
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <unordered_map>
#include <thread>
#include <map>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.1.0</version>
@RestController
@RequestMapping("/email")
public class EmailApiController {
private final EmailService emailService;
public EmailApiController(EmailService emailService) {
this.emailService = emailService;
}
@PreAuthorize("@authorizationService.hasPermission('SEND_MAIL', authentication)")
@Override
public void sendMail(SendMailRequest request) {
MimeMessage message = makeMessage(request);
addEmailLog(request);
sendMessage(message);
}