Skip to content

Instantly share code, notes, and snippets.

Avatar

Ricardo de Azambuja ricardodeazambuja

View GitHub Profile
View GitDeleteCommands.ps1
## Delete a remote branch
$ git push origin --delete <branch> # Git version 1.7.0 or newer
$ git push origin :<branch> # Git versions older than 1.7.0
## Delete a local branch
$ git branch --delete <branch>
$ git branch -d <branch> # Shorter version
$ git branch -D <branch> # Force delete un-merged branches
## Delete a local remote-tracking branch
@ricardodeazambuja
ricardodeazambuja / FeatherM0Express_ADLX377_Datalogger.ino
Last active Sep 22, 2020
Arduino sketch to log data using ADC from Adafruit Feather M0 Express
View FeatherM0Express_ADLX377_Datalogger.ino
//
// Adafruit Feather M0 Express ADC data logging
//
// Based on the Adafruit SdFat_circuitpython example
//
// The files can be accessed by double pressing the reset button and
// copying the circuitpython uf2 file (https://circuitpython.org/board/feather_m0_express/)
// into the featherboot drive (must be connected to the computer USB port :P)
// If you want to keep your arduino code, save the CURRENT.UF2 file before copying
// the circuitpython one from the link above.
@ricardodeazambuja
ricardodeazambuja / boot.py
Last active Aug 12, 2020
ADXL377 datalogging using Adafruit Feather M0 Express (almost 8 seconds of data with sample rate between 100 and 120Hz, 4 between 200Hz and 210Hz)
View boot.py
import storage
storage.remount("/", readonly=True) # to enable the code to save data to the flash this needs to be False
# After the system is reset with the above line set to False, it will not allow to update
# anything using the virtual USB drive. Therefore it's necessary to connect using the serial USB (minicom),
# enter the REPL (contr+c to cancel code.py if it's running and any key) and paste the line below:
# import os; os.remove("/boot.py"); fs=open("/boot.py", "w"); fs.write("import storage\nstorage.remount(\"/\", readonly=True)"); fs.close()
#
# Usage
@ricardodeazambuja
ricardodeazambuja / ransac_polyfit.py
Created May 5, 2020 — forked from geohot/ransac_polyfit.py
RANSAC polyfit. Fit polynomials with RANSAC in Python
View ransac_polyfit.py
def ransac_polyfit(x, y, order=3, n=20, k=100, t=0.1, d=100, f=0.8):
# Thanks https://en.wikipedia.org/wiki/Random_sample_consensus
# n – minimum number of data points required to fit the model
# k – maximum number of iterations allowed in the algorithm
# t – threshold value to determine when a data point fits a model
# d – number of close data points required to assert that a model fits well to data
# f – fraction of close data points required
besterr = np.inf
View backmatting.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ricardodeazambuja
ricardodeazambuja / EditGraph.py
Created Apr 22, 2020 — forked from ByungSunBae/EditGraph.py
simple tensorflow graph edit example
View EditGraph.py
# from : https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/graph_editor/examples/edit_graph_example.py
import numpy as np
import tensorflow as tf
from tensorflow.contrib import graph_editor as ge
# create a graph
g = tf.Graph()
with g.as_default():
View ssd_full_infer.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ricardodeazambuja
ricardodeazambuja / raspberry_fast_capture.py
Created Apr 15, 2020 — forked from CarlosGS/raspberry_fast_capture.py
Fast reading from the raspberry camera with Python, Numpy, and OpenCV. See the comments for more details.
View raspberry_fast_capture.py
# Fast reading from the raspberry camera with Python, Numpy, and OpenCV
# Allows to process grayscale video up to 124 FPS (tested in Raspberry Zero Wifi with V2.1 camera)
#
# Made by @CarlosGS in May 2017
# Club de Robotica - Universidad Autonoma de Madrid
# http://crm.ii.uam.es/
# License: Public Domain, attribution appreciated
import cv2
import numpy as np
@ricardodeazambuja
ricardodeazambuja / rawInjection.py
Created Mar 31, 2020 — forked from davidlares/rawInjection.py
Raw Sockets with Python: Sniffing and network packet injections.
View rawInjection.py
#!/usr/bin/python
import socket
import struct
# creating a rawSocket for communications
# PF_SOCKET (packet interface), SOCK_RAW (Raw socket) - htons (protocol) 0x08000 = IP Protocol
rawSocket = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.htons(0x0800))
# deciding interface - packet sniffing and then injection
@ricardodeazambuja
ricardodeazambuja / upload-github-release-asset.sh
Created Feb 21, 2020 — forked from stefanbuck/upload-github-release-asset.sh
Script to upload a release asset using the GitHub API v3.
View upload-github-release-asset.sh
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner