Skip to content

Instantly share code, notes, and snippets.

@serge-kilimoff
serge-kilimoff / watchdog_persistent_observer.py
Last active May 7, 2024 23:00
Persistent watchdog observer. When watchdog re-start, check if new/modify/delete/etc.. files or directories since the last launch, and send events for suscribers handlers.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Subclassing Observer for saving states of folders, and load this states at the next observation.
TODO : mapping events and handlers dispatching, for a shorter code.
"""
from __future__ import unicode_literals, print_function, division
import cPickle as pickle
import os
@TheWaWaR
TheWaWaR / gunicorn_service.py
Last active October 5, 2023 12:54
Gunicorn service script {Start | Restart | Stop | Reload | Quit}
#!/usr/bin/env python
#coding: utf-8
import os
import imp
import time
import signal
import argparse
import commands
@ashwin
ashwin / uni_init.cpp
Last active June 10, 2024 08:22
Examples of uniform initialization syntax in C++
#include <iostream>
#include <stack>
#include <unordered_set>
#include <vector>
class Point
{
public:
int x;
int y;
@maxtruxa
maxtruxa / Makefile
Last active May 12, 2024 21:49
Generic makefile for C/C++ with automatic dependency generation, support for deep source file hierarchies and custom intermediate directories.
# output binary
BIN := test
# source files
SRCS := \
test.cpp
# files included in the tarball generated by 'make dist' (e.g. add LICENSE file)
DISTFILES := $(BIN)
@balloy
balloy / watchdog_persistent_observer.py
Last active August 11, 2022 16:48 — forked from serge-kilimoff/watchdog_persistent_observer.py
Persistent watchdog observer. When watchdog re-start, check if new/modify/delete/etc.. files or directories since the last launch, and send events for suscribers handlers.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is forked from https://gist.github.com/serge-kilimoff/8163233
Supports Python 3 and fixed a few spell errors.
"""
"""
Subclassing Observer for saving states of folders, and load this states at the next observation.