Skip to content

Instantly share code, notes, and snippets.

View ricardodeazambuja's full-sized avatar

Ricardo de Azambuja ricardodeazambuja

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ricardodeazambuja
ricardodeazambuja / setup.py
Created May 15, 2023 22:58 — forked from juancarlospaco/setup.py
setup.py Template, Generic but Complete, with instructions to Release to PyPI, DEB, RPM, PKGBUILD, EXE, EGG, ZIP, PYZ, and more.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# To generate DEB package from Python Package:
# sudo pip3 install stdeb
# python3 setup.py --verbose --command-packages=stdeb.command bdist_deb
#
#
# To generate RPM package from Python Package:

GCC compiler optimization for ARM-based systems

2017-03-03 fm4dd

The gcc compiler can optimize code by taking advantage of CPU specific features. Especially for ARM CPU's, this can have impact on application performance. ARM CPU's, even under the same architecture, could be implemented with different versions of floating point units (FPU). Utilizing full FPU potential improves performance of heavier operating systems such as full Linux distributions.

-mcpu, -march: Defining the CPU type and architecture

These flags can both be used to set the CPU type. Setting one or the other is sufficient.

@ricardodeazambuja
ricardodeazambuja / add_repo_commit_to_hex.patch
Created March 8, 2023 14:36
INAV 6 patch to add repository name and commit to the generated hex file
# To apply this patch:
# git apply add_repo_commit_to_hex.patch
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04623c677..7a8005eea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,20 @@
cmake_minimum_required(VERSION 3.13...3.18)
# Cache sudo password
sudo -v
# Enable installation of 32-bit packages
sudo dpkg --add-architecture i386
# Install Adobe Reader
wget ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/AdbeRdr9.5.5-1_i386linux_enu.deb
sudo dpkg -i AdbeRdr9.5.5-1_i386linux_enu.deb
@ricardodeazambuja
ricardodeazambuja / opencv_raw_capture_v4l2.py
Last active January 12, 2023 16:18
How to capture a raw frame using OpenCV (python, should be "almost" the same with C++ besides creating a Mat first) compiled with V4L2 support
# $ v4l2-ctl --list-formats-ext
# It shows my webcam supports MJPG and YUYV
# More details https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/pixfmt-013.html
# And here we have some explanations about the flags available
# https://docs.opencv.org/4.x/d4/d15/group__videoio__flags__base.html
import cv2
cap = cv2.VideoCapture(0, cv2.CAP_V4L2) # I don't really need the CAP_V4L2 since it's the default
@ricardodeazambuja
ricardodeazambuja / Usage_Example_CrossEntropyLoss_and_BCELoss.py
Last active December 29, 2022 14:52
Usage Example for PyTorch CrossEntropyLoss and BCELoss (Binary Cross Entropy Loss) with Images (e.g. semantic segmentation)
# https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html
# https://pytorch.org/docs/stable/generated/torch.nn.BCELoss.html
import torch
from torch.nn import CrossEntropyLoss, BCELoss
# For this example:
# batch size = 1
# number of classes = 2
# size of tensors = 2x2
@ricardodeazambuja
ricardodeazambuja / using-google-takeout.md
Created December 5, 2022 13:39 — forked from chabala/using-google-takeout.md
Merge and extract tgz files from Google Takeout

Recently found some clowny gist was the top result for 'google takeout multiple tgz', where it was using two bash scripts to extract all the tgz files and then merge them together. Don't do that. Use brace expansion, cat the TGZs, and extract:

$ cat takeout-20201023T123551Z-{001..011}.tgz | tar xzivf -

You don't even need to use brace expansion. Globbing will order the files numerically:

$ cat takeout-20201023T123551Z-*.tgz | tar xzivf -
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ricardodeazambuja
ricardodeazambuja / gist:eb668cb015055f8c91eb9ed2f5f3ee43
Created March 12, 2022 22:55 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: