Skip to content

Instantly share code, notes, and snippets.

@gustavolaureano
gustavolaureano / main.py
Created August 4, 2023 20:15
MicroPython code for the raspberry pico to count how many WS2812 are connected, the data signal of the LEDs must be connected to GP2 and the ADC (GP26) must be connected to the strip ground after a jump wire (I used a cheap 20cm jumper cable), using the jumper as a shunt
import machine, neopixel, time
from machine import Pin, ADC
np = neopixel.NeoPixel(Pin(2), 200)
adcpin = machine.ADC(26)
while True:
num_of_leds = None
for i in range(len(np)):
onvalue = 0
import os
import time
import shutil
import argparse
# Create the argument parser
parser = argparse.ArgumentParser(description='Pico Firmware Flasher')
parser.add_argument('uf2_file_path', metavar='UF2_FILE', type=str, help='Path to the UF2 file')
parser.add_argument('-d', '--drive_letter', type=str, default='D:', help='Drive letter of the Pico (default: D:)')
@kconner
kconner / macOS Internals.md
Last active April 22, 2024 21:28
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

import os
import time
import shutil
import subprocess
import signal
import sys
import argparse
#If the applescript stops working or you don't want the function, set enableapplescript to False
enableapplescript = True
@sekcompsci
sekcompsci / Comparison Espressif ESP MCUs.md
Created June 18, 2021 03:56 — forked from fabianoriccardi/Comparison Espressif ESP MCUs.md
Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

A minimal table to compare the Espressif's MCU families.

ESP8266 ESP32 ESP32-S2 ESP32-S3 ESP32-C3 ESP32-C6
Announcement Date 2014, August 2016, September 2019, September 2020, December
@fabianoriccardi
fabianoriccardi / Comparison Espressif ESP MCUs.md
Last active March 30, 2024 22:55
Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

A minimal table to compare the Espressif's MCU families.

ESP8266 ESP32 ESP32-S2 ESP32-S3 ESP32-C3 ESP32-C6
Announcement Date 2014, August 2016, September 2019, September 2020, December
@joeycastillo
joeycastillo / bluemarble.py
Created August 1, 2020 20:12
Display real-time GOES-East imagery on a Waveshare 7-color EPD
# Based on Waveshare's epd5in65f.py demo. Copyright notice at end.
import sys
import os
picdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'pic')
libdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'lib')
if os.path.exists(libdir):
sys.path.append(libdir)
@PayasR
PayasR / routing_algorithm_implementations.txt
Last active December 25, 2023 08:52 — forked from systemed/gist:be2d6bb242d2fa497b5d93dcafe85f0c
Routing algorithm implementations
**Interesting/widely used implementations of pathfinding algorithms.
==========================================================================
A* Ruby https://github.com/georgian-se/shortest-path
A* (bidirectional with shortcuts) C++ https://github.com/valhalla/valhalla
A* Unity https://arongranberg.com/astar/front
NBA* JS https://github.com/anvaka/ngraph.path
NBA* Java https://github.com/coderodde/GraphSearchPal
NBA* Java https://github.com/coderodde/FunkyPathfinding
NBA* (Parallel) C++ https://github.com/janhsimon/PNBAStar

Foreward

This document was originally written several years ago. At the time I was working as an execution core verification engineer at Arm. The following points are coloured heavily by working in and around the execution cores of various processors. Apply a pinch of salt; points contain varying degrees of opinion.

It is still my opinion that RISC-V could be much better designed; though I will also say that if I was building a 32 or 64-bit CPU today I'd likely implement the architecture to benefit from the existing tooling.

Mostly based upon the RISC-V ISA spec v2.0. Some updates have been made for v2.2

Original Foreword: Some Opinion

The RISC-V ISA has pursued minimalism to a fault. There is a large emphasis on minimizing instruction count, normalizing encoding, etc. This pursuit of minimalism has resulted in false orthogonalities (such as reusing the same instruction for branches, calls and returns) and a requirement for superfluous instructions which impacts code density both in terms of size and

@Taytay
Taytay / install_hub.sh
Created June 26, 2018 19:12
Install latest version of Github's hub on Linux
#!/bin/bash
# Installs latest release of hub on Linux
# Echo, halt on errors, halt on uninitialized ENV variables. (https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/)
set -euxo pipefail
# Hub doesn't have a way to install the latest version using `apt` yet, so I wrote this as a hacky substitute.
# This will be unnecessary when this issue is resolved: https://github.com/github/hub/issues/718#issuecomment-65824284
# Linux options include: