Skip to content

Instantly share code, notes, and snippets.

View rnapoli's full-sized avatar
💭
working...

Ricardo Napoli rnapoli

💭
working...
View GitHub Profile
@liba2k
liba2k / ghidra.py
Last active September 5, 2024 14:51
Script to run Ghidra from the command line including automatic analysis and lunching Ghidra for existing projects.
#!/usr/bin/env python3
import os
import sys
import click
import subprocess
import tempfile
import itertools as IT
import select
from time import sleep
@nlohmann
nlohmann / remove_empty_elements.py
Created March 12, 2018 14:19
Remove empty arrays, objects or null elements from a JSON value
def remove_empty_elements(d):
"""recursively remove empty lists, empty dicts, or None elements from a dictionary"""
def empty(x):
return x is None or x == {} or x == []
if not isinstance(d, (dict, list)):
return d
elif isinstance(d, list):
return [v for v in (remove_empty_elements(v) for v in d) if not empty(v)]

Latency Comparison Numbers

Note: "Forked" from Latency Numbers Every Programmer Should Know

Event Nanoseconds Microseconds Milliseconds Comparison
L1 cache reference 0.5 - - -
Branch mispredict 5.0 - - -
L2 cache reference 7.0 - - 14x L1 cache
Mutex lock/unlock 25.0 - - -
@nepsilon
nepsilon / how-to-update-a-github-forked-repository.md
Created March 14, 2017 17:19
How to update a GitHub forked repository? — First published in fullweb.io issue #91

How to update a GitHub forked repository?

So you hit "Fork" and now you have this repo copy on your Github account. Here is what to do to keep it up-to-date with the original repo.

1. Add the original repo as remote, here called upstream:

git remote add upstream https://github.com/author/repo.git

2. Fetch all the branches of that upstream remote:

@gbaman
gbaman / HowToOTG.md
Last active September 16, 2024 09:47
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@gene1wood
gene1wood / all_aws_lambda_modules_python.md
Last active September 19, 2024 23:44
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7
@cmattoon
cmattoon / README.md
Last active July 1, 2024 14:32
Visual Binary Analysis

MySQL Dump

This shade of green happens to correspond to mostly-ASCII characters. This color green correlates to mostly ASCII chars

GPG Encryption

Symmetric (gpg -c) encryption of the above MySQL dump. Encryption - Random Colors in Random Places