Skip to content

Instantly share code, notes, and snippets.

View eusoubrasileiro's full-sized avatar
🐔
from ~

imbr eusoubrasileiro

🐔
from ~
View GitHub Profile
@eusoubrasileiro
eusoubrasileiro / auto property getter
Last active July 29, 2023 01:56
Decorator to create @Property getters for all my class instance attributes whose names start with one underscore Python3+
def auto_property_getters(cls):
class AutoPropertyClass(cls):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __getattr__(self, name):
if name in [attr[1:] for attr in dir(self) if attr.startswith('_') and not attr.startswith('__')]:
return getattr(self, f"_{name}")
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")
return AutoPropertyClass
-- Logs begin at Thu 2023-03-02 12:58:02 UTC, end at Thu 2023-03-02 13:01:15 UTC. --
Mar 02 12:58:02 localhost kernel: Booting Linux on physical CPU 0x0
Mar 02 12:58:02 localhost kernel: Linux version 4.9.299-tegra (buildbrain@mobile-u64-5333-d8000) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05) ) #1 SMP PREEMPT Tue Nov 22 09:24:39 PST 2022
Mar 02 12:58:02 localhost kernel: Boot CPU: AArch64 Processor [411fd071]
Mar 02 12:58:02 localhost kernel: OF: fdt:memory scan node memory@80000000, reg size 48,
Mar 02 12:58:02 localhost kernel: OF: fdt: - 80000000 , 3f800000
Mar 02 12:58:02 localhost kernel: OF: fdt: - bfa00000 , 3fe00000
Mar 02 12:58:02 localhost kernel: OF: fdt: - ffa00000 , 600000
Mar 02 12:58:02 localhost kernel: earlycon: uart8250 at MMIO32 0x0000000070006000 (options '')
Mar 02 12:58:02 localhost kernel: bootconsole [uart8250] enabled
@eusoubrasileiro
eusoubrasileiro / tse_hell.ipynb
Last active November 7, 2022 19:38
Acessing tse botetins de urnas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
>>> import pytz
>>>
>>> for tz in pytz.all_timezones:
... print tz
...
...
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
@eusoubrasileiro
eusoubrasileiro / event_id.patch
Last active June 24, 2022 18:08
new event_id patch
diff --git a/src/motion.c b/src/motion.c
index 4a2c2a7..788b7ff 100644
--- a/src/motion.c
+++ b/src/motion.c
@@ -554,6 +554,7 @@ static void motion_detected(struct context *cnt, int dev, struct image_data *img
cnt->prev_event = cnt->event_nr;
cnt->eventtime = img->timestamp_tv.tv_sec;
localtime_r(&cnt->eventtime, cnt->eventtime_tm);
+ cnt->event_id = ((unsigned long long) cnt->eventtime << 32) | cnt->thread_id;
@eusoubrasileiro
eusoubrasileiro / overlay_ro_var.sh
Last active June 10, 2022 13:14
jetson nano overlay read only filesystem (example /var folder)
# To prevent SD card corruption due powercuts etc. without /boot/inird
# this code can be used to protect any directory on your filesystem
# directory you know has lots of I/O
# Overlay mounts a union filesystem (or directory tree) where upper directory is protected
# This is an example for /var folder making it read only
# rw is done only on RAM (/dev/shm) hence logs etc. are lost on reboot
# create folders needed by overlay filesystem on /dev/shm (RAM)
mkdir -p /dev/shm/var_upper /dev/shm/var_workdir /dev/shm/var_overlay
@eusoubrasileiro
eusoubrasileiro / gist:5de6fcdafba522585415897ff7c94b62
Created June 2, 2022 16:52
motion log -d 9 sqlite3 in 4 cameras : Executing SQLite3 query SQLite3 error was (null)
[0:motiond] [NTC] [ALL] [Jun 02 12:47:28] motion_startup: Motion 4.4.0 Started
[0:motiond] [NTC] [ALL] [Jun 02 12:47:28] motion_startup: Using default log type (ALL)
[0:motiond] [NTC] [ALL] [Jun 02 12:47:28] motion_startup: Using log type (ALL) log level (ALL)
[0:motiond] [INF] [ALL] [Jun 02 12:47:28] conf_output_parms: Writing configuration parameters from all files (5):
[0:motiond] [INF] [ALL] [Jun 02 12:47:28] Thread 0 - Config file: /usr/local/etc/motion/motion.conf
[0:motiond] [INF] [ALL] [Jun 02 12:47:28] daemon off
[0:motiond] [INF] [ALL] [Jun 02 12:47:28] setup_mode off
[0:motiond] [INF] [ALL] [Jun 02 12:47:28] pid_file
[0:motiond] [INF] [ALL] [Jun 02 12:47:28] log_file /home/andre/logmotion4.txt
[0:motiond] [INF] [ALL] [Jun 02 12:47:28] log_level 9
[0:motiond] [NTC] [ALL] [Jan 10 08:44:42] motion_startup: Motion 4.4.0 Started
[0:motiond] [NTC] [ALL] [Jan 10 08:44:42] motion_startup: Using default log type (ALL)
[0:motiond] [NTC] [ALL] [Jan 10 08:44:42] motion_startup: Using log type (ALL) log level (INF)
[0:motiond] [INF] [ALL] [Jan 10 08:44:42] conf_output_parms: Writing configuration parameters from all files (5):
[0:motiond] [INF] [ALL] [Jan 10 08:44:42] Thread 0 - Config file: /home/andre/motion_server_nvr/motion_config/motion.conf
[0:motiond] [INF] [ALL] [Jan 10 08:44:42] daemon off
[0:motiond] [INF] [ALL] [Jan 10 08:44:42] setup_mode off
[0:motiond] [INF] [ALL] [Jan 10 08:44:42] pid_file
[0:motiond] [INF] [ALL] [Jan 10 08:44:42] log_file /home/andre/motion_log.txt
[0:motiond] [INF] [ALL] [Jan 10 08:44:42] log_level 7
import time
from bs4 import BeautifulSoup
from selenium import webdriver
import threading, multiprocessing
def create_driver():
"""returns a chrome webdriver headless"""
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument("--headless") # make it not visible
return webdriver.Chrome(options=chromeOptions)
@eusoubrasileiro
eusoubrasileiro / elastic_psv_parana.py
Last active December 15, 2021 13:09
Seismic: 2D finite difference simulation of elastic P and SV wave propagation Simulates Parana Basin geometry of basalt cover with 2 horizontal layers, acquires just z displacement (default seismic acquisition).
# This Python file uses the following encoding: utf-8
"""
Seismic: 2D finite difference simulation of elastic P and SV wave propagation
Simulates Parana Basin geometry of basalt cover with horizontal layers.
Acquires just z displacement (default seismic acquisition).
4 layers :
bauru ~ 100 meters ~ 6x scaled to 600 m
serra geral flow 1 ~ 20 meters ~ 6x scaled to 120 m
serra geral flow 2 ~ 20 meters ~ 6x scaled to 120 m