Skip to content

Instantly share code, notes, and snippets.

<?php
class StringTemplate
{
/**
* The input / base string template to use.
*
* @param string|null
*/
protected $template = null;
#!/usr/bin/env python3
import subprocess
# Hoeveelheid tijd (in minuten hier) welke een gebruiker inactief mag zijn
threshold = 30
# Bepaal welke gebruiker(s) er actief zijn en haal hier de velden uit welke
# nodig zijn
output = subprocess.run(['w', '-sh'], capture_output=True, text=True).stdout
@sebastiaanfranken
sebastiaanfranken / remove-nouveau.sh
Last active August 12, 2023 16:06
Removes the nouveau module/driver from Fedora 29+
#!/bin/bash
# Removes the xorg-x11-drv-nouveau package from this machine, because it's not needed
sudo dnf remove xorg-x11-drv-nouveau -y
# Blacklist the nouveau module as a module and in dracut
sudo echo 'blacklist nouveau' > /etc/modprobe.d/blacklist-nouveau.conf
sudo echo 'omit_drivers+=" nouveau "' > /etc/dracut.conf.d/blacklist-nouveau.conf
# Backup the current initramfs
@sebastiaanfranken
sebastiaanfranken / update-mirrors.sh
Created October 18, 2018 18:43
Update a yum mirror with reposync and createrepo
#!/bin/bash
# Which repos should we sync? You can edit this list to your
# hearts content. The values it accepts can be checked with
# the "$ yum repolist" command. Make sure you have yum-utils
# installed, first.
REPOS="base updates extras epel"
# Loop over the repos defined above and reposync them all,
# followed by a createrepo.
@sebastiaanfranken
sebastiaanfranken / showdown-window.ui
Created May 12, 2018 11:46
Showdown window.ui file with open button in headerbar
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.14"/>
<template class="ShowdownWindow" parent="GtkApplicationWindow">
<property name="width_request">640</property>
<property name="height_request">480</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Markdown Viewer</property>
<property name="default_width">1100</property>
@sebastiaanfranken
sebastiaanfranken / kvm-backup.sh
Last active September 9, 2024 12:59
Backup all VM's in KVM
#!/bin/bash
# This script creates a backup for all running libvirtd domains on the host it's
# run on.
#
# I created this script because I needed a lightweight backup solution for a pure libvirtd
# virtual machine host.
#
# You can use / modify this script however you like. All I ask is that if you find a bug or something
# very wrong (or if you find a massive upgrade point) is that you let me know!
@sebastiaanfranken
sebastiaanfranken / Router.php
Created August 26, 2017 21:32
Simple PHP router
<?php
namespace SebastiaanFranken;
use Exception;
class Router
{
/**
* @var array $routes The routing table
*/
@sebastiaanfranken
sebastiaanfranken / bootctl-postinst.sh
Created August 26, 2017 21:27
Update Fedora bootctl code, for (U)EFI booting
#!/bin/bash
# Version 0.2 by Sebastiaan Franken
# This is meant and tested on Fedora and Fedora only, with systemd-boot (bootctl)
# Place this file in /etc/kernel/postinst.d/ and don't forget to make it executable
# with chmod +x /etc/kernel/postinst.d/bootctl-postinst.sh
#
# Also, don't forget to modify the rootpath variable to reflect your situation
[ -f /etc/sysconfig/kernel ] && . /etc/sysconfig/kernel
#!/usr/bin/env python3.5
import os
import sys
import gi
gi.require_version("Gtk", "3.0")
gi.require_version("Gdk", "3.0")
gi.require_version("Notify", "0.7")
gi.require_version("GtkSource", "3.0")
#!/bin/bash
LAST=$(dnf list installed kernel.x86_64 | column | tail -n1 | tr -s " " | cut -d " " -f2)
INITRAMFS=/boot/initramfs-$(LAST).x86_64
VMLINUZ=/boot/vmlinuz-$(LAST).x86_64
cp $INITRAMFS /boot/efi/initramfs.img
cp $VMLINUZ /boot/efi/vmlinuz