Skip to content

Instantly share code, notes, and snippets.

View malte-j's full-sized avatar
❤️
🍍🍕

Malte Janßen malte-j

❤️
🍍🍕
View GitHub Profile
public void berechneRestZeitVonSchicht(int std, int min) {
int schicht = std / 8 + 1;
int volleMinuten = std * 60 + min;
int minutenEnde = schicht * 8 * 60;
int minutenBisEnde = minutenEnde - volleMinuten;
int stundenBisEnde = minutenBisEnde / 60;
@malte-j
malte-j / autorefresh.sh
Created March 4, 2019 13:52
Autorefresh and Compile LaTeX
mupdf Prüfung.pdf &
ls Prüfung.tex | entr /bin/sh -c "pdflatex Prüfung.tex && pkill -HUP mupdf"
@malte-j
malte-j / putIp.sh
Created January 11, 2019 20:47
Upload current IP to malts.me, using the client's hostname. Best run as cronjob
#!/bin/bash
ip addr >> $(hostname).txt
scp $(hostname).txt malts.me:~/ips
rm $(hostname).txt
@malte-j
malte-j / 10-motd
Created October 2, 2018 22:30
MOTD for Mazebot, put this in /etc/update-motd.d/
#!/bin/sh
upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
secs=$((${upSeconds}%60))
mins=$((${upSeconds}/60%60))
hours=$((${upSeconds}/3600%24))
days=$((${upSeconds}/86400))
UPTIME=`printf "%dd %02dh %02dm %02ds" "$days" "$hours" "$mins" "$secs"`
# get the load averages
import subprocess, time, os
// Startet vlc im Vollbild ohne Interface und in Dauerschleife
command = ['cvlc', '-f', '-L', '--no-video-title-show', '/home/malte/Videos']
// Gibt das Display vor, auf dem das VLC-Fenster geöffnet wird, an
environment = dict(os.environ, DISPLAY=":0")
// Startet den VLC Prozess
vlc = subprocess.Popen(command, env=environment)
@malte-j
malte-j / config.sh
Created April 10, 2018 20:03
Open Gnome Settings On i3
#!/bin/bash
env XDG_CURRENT_DESKTOP=GNOME gnome-control-center
fetch('/api/open', {
method: "POST",
body: JSON.stringify({
token: idToken
}),
headers: {
"Content-Type": "application/json"
}
})
@malte-j
malte-j / library-example.js
Created February 11, 2018 20:18
Require Example
// JSON Objekt mit text Attribut
let data = {
text: "lorem ipsum"
}
// gibt den Text zurück
module.exports.getText = () => data.text;
// setzt den Text
module.exports.setText = newText => data.text = newText;
@malte-j
malte-j / currentYear.js
Created January 3, 2018 22:12
appends the current year to all elements with the '.currYear' class
// append the current year to all elements with the '.currYear' class
document.querySelectorAll('.currYear').forEach(node => node.textContent += (new Date()).getFullYear())
const request = require('request');
// Request Header
var headers = {
'User-Agent': 'Secret Agent/0.0.1',
'Content-Type': 'application/x-www-form-urlencoded'
}
// Liste der comments
const comments = [