All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Register

Login


All New Register Login
's Avatar

nithir

Joined 1728392273

Recently created
Least recently created
Recently updated
Least recently updated
All gists 55 Liked 2
nithir's Avatar

nithir / modèle de base pour un fichier python

1 likes
0 forks
1 files
Last active 1734009670
logger, argparse, verbose tous ce qu'il faut pour démarrer un programme concret, modèle, template, base, python
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 def app():
5 import logging
6 from logging.handlers import RotatingFileHandler
7 import argparse
8
9 # construction du logger
10 LOGGER = logging.getLogger()
nithir's Avatar

nithir / modèle de base pour script shell

1 likes
0 forks
1 files
Last active 1734009608
1 #!/usr/bin/env bash
2
3 # sécurisation de l'éxécution (mode strict)
4 set -e # plante le batch sur une erreur lors de l'éxécution (pas besoin de traiter le return code pour ça)
5 set -u # plante le batch si on utilise une variable non défini
6 set -o pipefail # plante le batch si une commande dans un pipe plante
7
8 #IFS=$'\n\t' # gestion des espaces dans les lignes si besoin
9
10 ##
Newer Older

Powered by Opengist ⋅ Load: 65ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文