This file contains hidden or 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 | |
| # /usr/libexec/bar-collector | |
| VERSION=0.2 | |
| DELAY="0.1" | |
| if [[ $1 = "--help" ]]; then | |
| echo "NAME:" |
This file contains hidden or 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/lib/rhc/collector.d/com.redhat.foo.toml | |
| [meta] | |
| name = "Red Hat Foo Collector" | |
| [exec] | |
| version_command = "/usr/libexec/foo-collector --version" | |
| user = "foo" | |
| group = "foo" | |
| [exec.collector] |
This file contains hidden or 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
| { | |
| "data":[ | |
| { | |
| "header":{ | |
| "handle":0, | |
| "type":0, | |
| "length":24 | |
| }, | |
| "description":"BIOS Information", | |
| "values":{ |
This file contains hidden or 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
| { | |
| "BIOS Information": { | |
| "Vendor": "SeaBIOS", | |
| "Version": "1.16.2-1.fc38", | |
| "Release Date": "04/01/2014", | |
| "Address": "0xE8000", | |
| "Runtime Size": "96 kB", | |
| "ROM Size": "64 kB", | |
| "Characteristics:": [ | |
| "BIOS characteristics not supported", |
This file contains hidden or 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
| """ | |
| Example of using fcntl.flock for locking file. Some code inspired by filelock module. | |
| """ | |
| import os | |
| import fcntl | |
| import time | |
| def acquire(lock_file): |
This file contains hidden or 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
| """ | |
| Example of using sub-parser, sub-commands and sub-sub-commands :-) | |
| """ | |
| import argparse | |
| def main(args): | |
| """ | |
| Just do something |
This file contains hidden or 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 | |
| echo "reseting config file..." | |
| cp /etc/rhsm/rhsm.conf.default /etc/rhsm/rhsm.conf | |
| echo "restarting rhsm.service..." | |
| systemctl restart rhsm.service | |
| # Set new variables using D-Bus API | |
| echo "changing configuration..." |
This file contains hidden or 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
| class Singleton(object): | |
| """ | |
| Singleton and parent for singletons | |
| """ | |
| _instance = None | |
| _initialized = False | |
| def __new__(cls, *args, **kwargs): | |
| """ |
This file contains hidden or 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
| CMAKE_MINIMUM_REQUIRED (VERSION 3.11.2) | |
| project(example C) | |
| include(GNUInstallDirs) | |
| set(CMAKE_C_STANDARD_REQUIRED ON) | |
| set(CMAKE_C_STANDARD 11) | |
| # Build type |
This file contains hidden or 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 | |
| import requests | |
| import time | |
| import copy | |
| from multiprocessing import Process | |
| from data import URLS | |
| def send_request(num, url): |
NewerOlder