Skip to content

Instantly share code, notes, and snippets.

View romanpeters's full-sized avatar
💯
Keepin' it 100

Roman romanpeters

💯
Keepin' it 100
View GitHub Profile
@romanpeters
romanpeters / login_duo_session
Last active November 2, 2022 18:36
Duo SSH MFA sessions
#! /bin/bash
# This script prompts users logging in over SSH for Duo MFA authentication
# but only if they haven't already authenticated within the last 30 minutes.
# Enable it by adding this line to sshd_config:
# ForceCommand login_duo_session
# The script must be executable by the user logging in
# login_duo needs to be installed, see https://duo.com/docs/loginduo
version: '3.7'
# Make sure to create a plex user with uid 1080
# Create the movies, tvshows and download dirs and change their ownership to the plex user
# Make sure to change the lines marked with "<--!" for your own configuration
services:
plex:
image: lscr.io/linuxserver/plex:latest
container_name: plex
@romanpeters
romanpeters / mc-hibernate.py
Created March 7, 2019 11:11
Automatically start and stop Minecraft server docker container (itzg/minecraft-server)
"""
This script automatically starts and stops a Minecraft server's Docker container.
If someone tries to join the container is started.
If no players are online anymore the container is stopped.
"""
import socket
import time
import subprocess
import logging
import sys
import time
import random
import datetime
import telepot
from pprint import pprint
from telepot.namedtuple import InlineKeyboardMarkup, InlineKeyboardButton, InlineQueryResultPhoto
import database as db
from redacted import API_KEY, CHAT_URL, BOT
@romanpeters
romanpeters / koala_rss.py
Last active June 28, 2018 13:12
Koala RSS
# -*- coding: utf-8 -*-
from app import app
from urllib.request import urlopen
import datetime
from werkzeug.contrib.atom import AtomFeed
import json
url = "wwww.your-site.com"
feed = AtomFeed("Sticky activiteiten", feed_url=f"{url}/koala.xml", url=url)