Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
OUTPUT_DIR=""
INPUT_FILE=""
ZOOM=0.7
WIDTH=1080
HEIGHT=1080
ROTATE_X=0
ROTATE_Z=45
ROTATION=360 # Total rotation angle
@hyperglitch
hyperglitch / svd-dump.py
Last active September 9, 2022 11:10 — forked from devanlai/svd-dump.py
gdb script for dumping STM32 registers
"""
Utilities for dumping STM32 peripheral registers with tab-completion
Based on a script by vampi-the-frog
Dependencies:
pip install -U cmsis-svd
Usage (inside gdb):
(gdb) source /path/to/svd-dump.py

Best practices for PCB Design

Schematics

  • Power symbols should point upwards
  • Ground symbols should point downards
  • Sections should be labeled
  • Nets should generally not cross
  • Nets should be labeled
  • Either global or regular labels are fine
@newhouseb
newhouseb / pll.py
Created February 3, 2021 16:26
ECP5 PLL w/ nmigen
from nmigen import *
from pprint import pprint
PFD_MIN = 3.125
PFD_MAX = 400
VCO_MIN = 400
VCO_MAX = 800
def find_pll_params(input, output):
freqs = []
@gregdavill
gregdavill / ecp5_swap_idcode.py
Created October 1, 2019 12:25
Script for use with prjtrellis to swap the IDCODE of a ECP5 bitstream
#!/usr/bin/env python3
"""
This simple example uses PyTrellis to unpack, change the IDCODE, and pack a bitstream
"""
import pytrellis
pytrellis.load_database("/usr/share/trellis/database")
bs = pytrellis.Bitstream.read_bit("build/gateware/impl/top_impl.bit")
chip = bs.deserialise_chip()
@zerog2k
zerog2k / gist:f830c5722c4686c327e2850406cb9377
Last active July 11, 2020 11:17
ID115 ble command set exploration
ID115
settings write on uuid 0x0af6 to device:
responses read on uuid 0x0af7 (notify?)
------
startup - scan:
> 0204
< Value: 0204f2fc581240a6
> Value: 0202
< Value: 02025b0a8f01076d6b050f06
@yorikvanhavre
yorikvanhavre / io_import_fcstd.py
Last active July 17, 2023 20:43
Blender FreeCAD importer stub
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@gbaman
gbaman / HowToOTGFast.md
Last active May 14, 2024 10:26
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@gbaman
gbaman / HowToOTG.md
Last active May 16, 2024 20:10
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