Skip to content

Instantly share code, notes, and snippets.

View patrickelectric's full-sized avatar
🏡
Working from home

Patrick José Pereira patrickelectric

🏡
Working from home
View GitHub Profile
#include <cstdint>
#include <cstdio>
namespace version_helper {
/**
* @brief Create the header sequence with checksum based in a string
*
* @tparam Type: Desired type of header
* @tparam N: Size of string
* @return Type: Header sequence created with checksum
@patrickelectric
patrickelectric / camera.xml
Created September 16, 2020 16:28
mavlink camera description file for QGC
<?xml version="1.0" encoding="UTF-8" ?>
<mavlinkcamera>
<definition version="1">
<model>HD Pro Webcam C920</model>
<vendor>HD Pro Webcam C920</vendor>
</definition>
<parameters>
<parameter name="camera-mode" type="uint32" default="1" control="0">
<description>Camera Mode</description>
<options>
@patrickelectric
patrickelectric / hunter_pylinter.sh
Created September 2, 2020 17:49
Find all pylint checks that are failing and print human friendly name for pylintrc
#!/usr/bin/env bash
keys=( $(pylint $(git ls-files '*.py') | rg '.*py:\d+:\d+: (.*):.*' -r '$1' | sort | uniq) )
msgs=( $(pylint --list-msgs | rg ":(.*) \(([A-Z]\d+)\).*" -r '$1,$2' | sort) )
for msg in "${msgs[@]}"; do
for key in "${keys[@]}"; do
if [[ $msg == *"$key" ]]; then
echo "${msg::-5}"
fi
done

+++ title = 'How to rock: Doing the right thing' date = 2020-08-31T13:55:39z draft = true [taxonomies] tags = [ "kde", "development", "tutorial", "how-to-rock" ] [extra] header = "/assets/how_to_rock/maintain.jpg" +++

import collections
import jinja2
import json
import re
import requests
from bs4 import BeautifulSoup
# Maybe we should generate it from wpa_cli help
class Parser():
import socket
import multiprocessing
import time
class WPASupplicant:
BUFFER_SIZE = 4096
target = ('0.0.0.0', 6664)
sock = None
process = None
{
"profiles": [
{
"profile_name": "Patrick",
"player": {
"name": "Patrick",
"color": "#ff0000",
"is_game_master": true
},
"character": {
@patrickelectric
patrickelectric / minimal_rtsp_player.qml
Last active November 8, 2022 13:58
A minimal QML project for rtsp video
import QtQuick 2.7
import QtQuick.Controls 2.3
import QtMultimedia 5.8
Item {
id: parentLayout
width: 640
height: 400
Video {
@patrickelectric
patrickelectric / 1k.txt
Created April 10, 2020 03:44
1k common word in english
be
and
of
a
in
to
have
too
it
I
{
"AHRS": {
"accel_weight": 0.0,
"error_rp": 0.003254679264500737,
"error_yaw": 0.0017316457815468311,
"message_information": {
"counter": 14648,
"frequency": 276.3773498535156,
"time": {
"first_message": "2020-07-03T19:42:45.307198-03:00",