Skip to content

Instantly share code, notes, and snippets.

View dbuteau's full-sized avatar
🀘
Always busy

Daniel Buteau dbuteau

🀘
Always busy
  • Sophia Antipolis, France
View GitHub Profile
@dbuteau
dbuteau / betterpiaf
Created November 17, 2022 08:26
UserScript(TamperMonkey) to toggle display of pouet column for framapiaf mastodon instance
// ==UserScript==
// @name Toggle Framapiaf column
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Daniel Buteau
// @match https://framapiaf.org/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=framapiaf.org
// @require https://code.jquery.com/jquery-3.6.1.slim.min.js
// @grant none
@dbuteau
dbuteau / require_updated_git_branch.py
Last active April 21, 2022 08:18 — forked from bhcopeland/require_updated_git_branch.py
ansible callback_plugin to check that the locally git directory is up to date/in sync.
#! /usr/bin/env python3
# coding: utf-8
import os
import re
import subprocess
import sys
from ansible import __version__ as ANSIBLE_VERSION
if ANSIBLE_VERSION.startswith('2'):
@dbuteau
dbuteau / python_example.py
Created February 20, 2020 13:20
tricky python functions
#!/usr/bin/env python3
# encoding: utf-8
"""
count the number of objects containing attributes values (regex) in list of objects
made regex case insensitive
"""
import re
class user:
def __init__(self, name, age):
@dbuteau
dbuteau / crontab_header
Last active June 14, 2019 13:48
crontab header for reminder
#β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ minutes: 0-59, */2 every 2 minutes
#β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ Hours: 0-23
#β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ Day: 1-31
#β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ Month: 1-12
#β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ WeekDay: 0-7; Sunday=0, Saturday=6
#β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ user which will exec the command (can be not supported on somes systems)
#β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
#* * * * * user command to execute
#eg: execute backup at 2h30 and 14h30 from monday to friday
#30 2,14 * * 1-5 root /usr/local/sbin/backup.sh
@dbuteau
dbuteau / check-login.sh
Last active May 14, 2019 18:08
check /etc/shadow and say if you found correct password or not
#!/bin/bash
# usefull if you don't remember which password you setted
# you can try misc password and the script will warn you
# when you found the correct one
# Requirement:
# you need to install "whois" package
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit