Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View matty0005's full-sized avatar
😎

Matthew Gilpin matty0005

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

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 January 9, 2022 08:24
Code to display PM readings on a small OLED screen
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 January 23, 2022 05:58
Attiny 85 Low voltage cutoff
#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 11:01
getsig - Simply take a photo of your signature and instantly get a digital version.
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 December 30, 2016 11:31 — 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.
#!/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)