Skip to content

Instantly share code, notes, and snippets.

@pv
pv / colorized_voronoi.py
Last active June 27, 2024 22:07
Colorized Voronoi diagram with Scipy, in 2D, including infinite regions
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import Voronoi
def voronoi_finite_polygons_2d(vor, radius=None):
"""
Reconstruct infinite voronoi regions in a 2D diagram to finite
regions.
Parameters
@rroblak
rroblak / README.md
Last active October 26, 2023 03:22
git diff image files on the command line, with color

This is a simple way to spot check that the modified image in your git index is the image you actually want without having to leave the command line.

Example: http://i.imgur.com/RUenUcM.png

Instructions

  1. Install git, ImageMagick, and jp2a via your favorite package manager.
  2. Put img-ascii-diff somewhere (e.g. ~/bin/img-ascii-diff).
  3. Put attributes in ~/.config/git/attributes.
  4. Modify ~/.gitconfig and add the lines below, pointing to wherever you put img-ascii-diff.
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@DraTeots
DraTeots / ComPort over Network.md
Last active November 15, 2024 13:34
ComPort over Network
@ddennedy
ddennedy / getgop.sh
Last active March 29, 2018 22:21
display the GOP structure of a video file (requires ffprobe)
#!/bin/sh
startswith() { case $1 in $2*) true;; *) false;; esac; }
tmpfile=$(mktemp)
ffprobe -show_frames "$1" 2> /dev/null > "$tmpfile"
GOP=1
maxGOP=1
Bframes=0
@gbaman
gbaman / HowToOTG.md
Last active November 3, 2024 17:19
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

anonymous
anonymous / dspHostDrum8.ino
Created October 1, 2016 15:32
Drum8 code for the dsp-Host module
// Copyright 2016 DSP Synthesizers Sweden.
//
// Author: Jan Ostman
//
// 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 3 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
@ckuethe
ckuethe / openocd-trinket.cfg
Created August 30, 2018 16:09
OpenOCD configuration for an Adafruit Trinket M0 (probably others too) connected via generic ST-Link v2 programmer
# OpenOCD configuration for the Adafruit Trinket M0
# https://www.adafruit.com/product/3500
# connected via a generic ST-Link/v2 compatible programmer
# https://amazon.com/s/?keywords=stlink%20v2
# Consult the pinout for the location of the SWCLK and SWDIO pins
# and connect the 3.3v line on the programmer to VBAT
# https://learn.adafruit.com/assets/49778
# It's not necessary to set the adapter speed, since OpenOCD
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active November 17, 2024 14:13
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}