This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ask(question, answers_type=None, answers=None, menu=None, menu_args=None): | |
""" Ask a question. (duh!) | |
Params: | |
- question: a string representing the question to ask | |
- answers_type: raw input will be casted to this tipe (if None, answer will be kept as string) | |
- answers: a list containing the feasible answers (if None, the answer can be any) | |
- menu: a function that prints a user menu | |
- menu_args: optional parameters to pass to menu function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
events = ("warning", "Warning", "error", "Error") # put here strings of interest in log | |
log_file = sys.argv[1] | |
log_separator = ':' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
spinner() | |
{ | |
local phrase="Doing stuff..." | |
local pid=$1 | |
local delay=0.5 # Adjust spinner speed | |
local spinstr='|/-\' # Spinner sequence | |
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do | |
local temp=${spinstr#?} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Basic echo between Python3 client and C server, and vice versa, via socket using Python ctypes |