Skip to content

Instantly share code, notes, and snippets.

View Thesola10's full-sized avatar
🐢
slow day

Karim Vergnes Thesola10

🐢
slow day
View GitHub Profile
@Thesola10
Thesola10 / mk302.py
Created May 18, 2021 17:38
Generate a static redirect page. Can be useful on IPFS for link shortening for instance.
#!/usr/bin/env python3
# mk302 by Karim Vergnes <me@thesola.io>
# License: CC0 1.0 Universal
# Requires Jinja2
'''<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="REFRESH" content="0;url={{ href }}"" />
<script>window.location.href="{{ href }}"</script>
@Thesola10
Thesola10 / francais.h
Last active November 12, 2021 14:40
Vous aussi, programmez en fran-C !
#define vide void
#define si if
#define sinon else
#define retourner return
#define pour for
#define tantque while
#define faire do
#define booleen bool
#define entier int
#define caractere char
@Thesola10
Thesola10 / pixbat.py
Last active January 26, 2022 07:10
Wrapper around bat and pixcat to display images in the bat command
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This script is designed to be installed in ~/.local/bin/bat or equivalent
from os import execvp
import sys
import subprocess
if __name__ == "__main__":
try:
@Thesola10
Thesola10 / lib.mk
Created May 30, 2021 13:25
Useful resources for pretty makefiles.
GREEN := $(shell tput setaf 2 2>/dev/null)
YELLOW := $(shell tput setaf 3 2>/dev/null)
BOLD := $(shell tput bold 2>/dev/null)
RESET := $(shell tput sgr0 2>/dev/null)
define rich_echo
printf "${BOLD}$(1)${RESET}\t$(2)\n"
endef
@Thesola10
Thesola10 / key-gnat.py
Last active January 31, 2022 10:11
(in)elegant weapons, for a more civilized age.
#!/usr/bin/env python3
# key-gnat by Karim Vergnes <me@thesola.io>
# License: WTFPL 1.0
# Requires evdev python to be installed
from evdev import UInput, ecodes as e
import random, time
ui = UInput(name="Unsuspicious keyboard™")
@Thesola10
Thesola10 / webroulette.sh
Last active January 31, 2022 10:12
(in)elegant weapons, for a more civilized age.
#!/bin/bash
# WebRoulette by Karim Vergnes <me@thesola.io>
# License: WTFPL 1.0
# Requires xdg-open and a web browser to work.
# Location of the sitefile
: ${LIST:="$HOME/.sitefile"}
# Time interval for sleep
: ${SLEEP_INT:="20-300"}
@Thesola10
Thesola10 / chroma.sh
Last active January 31, 2022 10:12
(in)elegant weapons, for a more civilized age.
#!/bin/bash
# chroma by Karim Vergnes <me@thesola.io>
# License: WTFPL 1.0
# Requires xrandr to work.
# Display to modify
: ${XRDISP:="eDP1"}
# Speed at which to alternate colors
: ${COEF:=1}
# Intensity of result
@Thesola10
Thesola10 / make.sh
Last active January 31, 2022 10:13
sudo make me a sandwich
#!/bin/bash
# make-sandwich by Karim Vergnes <me@thesola.io>
# XKCD/149-compliant wrapper for Make
# License: WTFPL 1.0
# Requires make to work. To install, place in /usr/local/bin/
if ! which /usr/bin/make > /dev/null 2>&1
then
echo "make is not installed. See your distribution's info to install it."
exit 3
@Thesola10
Thesola10 / potdefleurs.py
Last active January 31, 2022 10:13
bidule orienté objet
#!/usr/bin/env python3
# Un pot de fleurs pour apprendre à coder :)
# © Karim Vergnes <me@thesola.io>
# Sous licence Creative Commons Attribution, NonCommercial, ShareAlike (CC BY,NC,SA)
# https://creativecommons.org/licenses/by-nc-sa/3.0/fr/
class Potdefleur:
couleur = str()
fleurs = list()
@Thesola10
Thesola10 / reboot.sh
Last active March 22, 2022 09:53
Reboot to an arbitrary UEFI entry
#!/bin/bash
# Reboot-EFI (c) Karim Vergnes <me@thesola.io>
# Wrapper to reboot to a set UEFI entry
# Requires efibootmgr and fzy
rebootcmd="shutdown -r now"
trap _exit KILL INT TERM
_exit() {