Skip to content

Instantly share code, notes, and snippets.

View azertyfun's full-sized avatar

Nathan Monfils azertyfun

View GitHub Profile
@azertyfun
azertyfun / linear_strategy_start_at_task.py
Created March 11, 2020 15:07
Ansible linear strategy that supports the START_AT_TASK environment variable
#!/usr/bin/env python3
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
strategy: linear_checkpoints
short_description: Executes tasks in a linear fashion, allow start-at-task to run `always` tags
description:
- Task execution is in lockstep per host batch as defined by C(serial) (default all).
#!/usr/bin/python2
import multiprocessing
import time
def test(i):
print "test({})".format(i)
time.sleep(0.5)
def main():
@azertyfun
azertyfun / led_cpu
Created April 4, 2014 19:12
Script that can power a led with the raspberry pi, using GPIO_11 (physical 23) and GRND (physical 14) when CPU usage > 50%
#!/usr/bin/python
import psutil
import sys
import os
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("ERROR : This program needs to be executed as root")
@azertyfun
azertyfun / F-FAT16 specs - new
Last active December 30, 2015 23:09
Spécifications pour F-FAT16 (FrOSt-Foundation/FrOSt).
En-tête :
2 mots : 0xFF16, 0xFF16. Permettent d'intenfitifer le disque comme FFAT-16 compatible.
2 mots : Numéro de série du disque. Par défaut, 0xF057, 0x1337.
15 mots : Le nom du disque human-readable. Peut terminer par plusieurs zéros.
La FAT occupe le second bloc. Il y a autant d'entrées que de fichiers. Elles peuvent être dans le désordre mais il ne peut y avoir de blanc entre les entrées.
Structure d'une entrée FAT (une entrée est longue de 16 mots) :
1 mot : Taille en secteurs du fichier.
1 mot : Secteur de début.
14 mots : Nom de fichier.