Skip to content

Instantly share code, notes, and snippets.

View FunDeckHermit's full-sized avatar

Roy van Lierop FunDeckHermit

  • Noldus Information Technology
  • Gelderland
View GitHub Profile
@ilyasst
ilyasst / python_systemd.md
Last active April 15, 2024 04:34
Run a python script forever using systemd

Run a python script forever

In this section, we are going to show how to run a python script as a systemd service, allowing you to boot it at the start of a Linux machine and to maintain it alive.

Test method: Telegram Bot

We are going to use a very basic Telegram bot in order to test that our script will:

  1. Automatically start when the machine boot
  2. Automatically restart when it crashes/exits for whichever reason
@vi
vi / hextobin.c
Created August 25, 2017 15:10
Hex string to byte buffer in C
// Based on https://stackoverflow.com/a/23898449/266720
void tallymarker_hextobin(const char * str, uint8_t * bytes, size_t blen)
{
uint8_t pos;
uint8_t idx0;
uint8_t idx1;
// mapping of ASCII characters to hex values
const uint8_t hashmap[] =
{