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
# encoding=utf8 | |
import os, zipfile, rarfile, tarfile, shutil | |
# avoid encoding problems | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf8') | |
def remove_file_or_tree(p): |
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
source s_fail2ban { | |
file("/var/log/fail2ban.log" follow-freq(10) flags(no-parse)); | |
}; | |
parser fail2ban-parser { | |
python( | |
class("Fail2BanParser") | |
options("regex", '(?P<timestamp>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}) (?P<PROGRAM>.+?)\.(?P<type>.+?) +\[(?P<PID>\d+)\]: (?P<level>.+?) +(?P<MSG>.+)') | |
); | |
}; |
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
log { | |
source { file("/var/log/dsmsched.log" follow-freq(10) flags(no-parse)); }; | |
parser { python(class("TivoliParser")); }; | |
destination(d_syslog_tcp); | |
}; | |
python { | |
import re | |
import dateutil.parser | |
import socket |
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
import cv2 | |
import numpy as np | |
class Camera: | |
def __init__(self, eye_point, rot_matrix_world_to_cam, intrinsic_matrix, distortion_coeffs): | |
"""Initializes camera. | |
Args: | |
eye_point: position of the camera in world coordinates |
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 parallel_map_as_tf_dataset( | |
fun, iterable, *, output_types=None, output_shapes=None, shuffle_before_each_epoch=False, | |
extra_args=None, n_workers=10, n_epochs=None): | |
"""Maps `fun` to each element of `iterable` and wraps the resulting sequence as | |
as a TF Dataset. Elements are processed by parallel workers using multiprocessing. | |
Args: | |
fun: A function that takes an element from `iterable` plus `extra_args` and returns a sequence of | |
numpy arrays. | |
iterable: An iterable holding the input objects, which can be any Python objects, not just numpy arrays. |
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
# Copyright 2021 Istvan Sarandi | |
# MIT License | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software | |
# and associated documentation files (the "Software"), to deal in the Software without restriction, | |
# including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | |
# subject to the following conditions: | |
# The above copyright notice and this permission notice shall be included in | |
# all copies or substantial portions of the Software. |
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
# Copyright (c) 2020 István Sárándi <sarandi@vision.rwth-aachen.de> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all |
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
# Requires installing the following via pip | |
# pip install tensorflow tensorflow_hub transforms3d | |
# pip install git+https://github.com/isarandi/{cameralib,poseviz,simplepyutils,tensorflow-inputs}.git | |
import logging | |
import os | |
os.environ['OMP_NUM_THREADS'] = '1' | |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1' | |
os.environ['KMP_INIT_AT_FORK'] = 'FALSE' |
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
import glob | |
import cv2 | |
import numpy as np | |
def main(): | |
checkerboard_size = (6, 8) | |
image_paths = glob.glob('checkerboard_images/*.jpg') |