Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Gilpin matty0005

View GitHub Profile
@matty0005
matty0005 / installing_riscv_32_toolchain_m1.md
Last active Jan 29, 2023
Instructions to install the 32bit risc-v toolchain on apple silicon devices (eg, m1)
View installing_riscv_32_toolchain_m1.md

If you're having trouble compiling and installing the 32bit toolchain (riscv32-unknown-elf-gcc, etc) for RISC-V on your M1/Apple Silicon Mac, here is a guide to how I installed it.

brew edit riscv-gnu-toolchain  

This will open a text editor of your choice. Inside this, you want to edit the args on line 59 to include the --with-arch=rv32i and --with-abi=ilp32 arguments. The end result should look like:

@matty0005
matty0005 / pmsmeter.py
Last active Jan 9, 2022
Code to display PM readings on a small OLED screen
View pmsmeter.py
import serial
import board
import busio
import adafruit_ssd1306
import requests
import time
from time import sleep
from PIL import Image, ImageDraw, ImageFont
@matty0005
matty0005 / main.c
Last active Jan 23, 2022
Attiny 85 Low voltage cutoff
View main.c
#include <avr/io.h>
#include <util/delay.h>
#define MOSFET 4
#define LED 1
/* Returns the voltage of a battery in mV */
uint16_t measure_voltage() {
ADCSRA |= (1 << ADSC); //Start conversion
while ((ADCSRA & (1 << ADSC)) != 0)
@matty0005
matty0005 / getsig.py
Created May 9, 2018
getsig - Simply take a photo of your signature and instantly get a digital version.
View getsig.py
import numpy as np
import cv2
img = cv2.imread("OrigImg.jpg",0)
kernel = np.ones((5,5), 'uint8')
ret, thresh_basic = cv2.threshold(img,155,255,cv2.THRESH_BINARY)
thresh_adapt = cv2.adaptiveThreshold(img, 255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,115,1)
erode = cv2.erode(thresh_basic,kernel,iterations=1)
@matty0005
matty0005 / speedtest-ifttt.sh
Created Dec 30, 2016 — forked from aallan/speedtest-ifttt.sh
Modified version of Henrik Bengtsson's speedtest-cli code which will dispatch the test results to the IFTTT Maker Channel.
View speedtest-ifttt.sh
#!/usr/bin/env bash
###########################################################################
# Originally written by: Henrik Bengtsson, 2014
# https://github.com/HenrikBengtsson/speedtest-cli-extras
# Modified to use IFTTT by: Alasdair Allan, 2015
# License: GPL (>= 2.1) [http://www.gnu.org/licenses/gpl.html]
###########################################################################
# Character for separating values
# (commas are not safe, because some servers return speeds with commas)