Skip to content

Instantly share code, notes, and snippets.

View RobCranfill's full-sized avatar

Rob Cranfill RobCranfill

View GitHub Profile
@todbot
todbot / synthio_portamento_hack.py
Last active January 16, 2025 08:48
a hacky way to do portamento in synthio in CircuitPython
# synthio_portamento_hack.py -- a hacky way to do portamento in synthio
#
import board, time, random
import audiobusio, audiomixer, synthio
import ulab.numpy as np
lck_pin, bck_pin, dat_pin = board.MISO, board.MOSI, board.SCK
audio = audiobusio.I2SOut(bit_clock=bck_pin, word_select=lck_pin, data=dat_pin)
mixer = audiomixer.Mixer(voice_count=1, sample_rate=28000, channel_count=1,
@todbot
todbot / synthio_filter_test.py
Created June 6, 2023 00:40
trying out new synthio filter PR, knobs control frequency and resonance, in CircuitPython
# synthio_filter_test.py -- trying out new filter PR, knobs control frequency and resonance
# 5 Jun 2023 - @todbot / Tod Kurt
import time, random, board, analogio, audiopwmio, synthio
audio = audiopwmio.PWMAudioOut(board.GP10)
synth = synthio.Synthesizer(sample_rate=22050)
audio.play(synth)
knob1 = analogio.AnalogIn(board.GP26)
knob2 = analogio.AnalogIn(board.GP27)
@todbot
todbot / synthio_two_knob_drone_synth.py
Last active October 26, 2024 17:25
Got a Pico and two pots? Now you got a drone synth. In CircuitPython of course
# synthio_two_knob_drone_synth.py -- Got a Pico and two pots? Now you got a drone synth
# 5 Jun 2023 - @todbot / Tod Kurt
# video demo: https://www.youtube.com/watch?v=KsSRaKjhmHg
import time, random, board, analogio, audiopwmio, synthio
knob1 = analogio.AnalogIn(board.GP26)
knob2 = analogio.AnalogIn(board.GP27)
audio = audiopwmio.PWMAudioOut(board.GP10)
synth = synthio.Synthesizer(sample_rate=22050)
@todbot
todbot / dual_i2s_player.py
Last active December 25, 2024 02:58
Demonstrate using two I2S stereo DACs at once on RP2040 / Raspberry Pi Pico in CircuitPython
# dual_i2s_player.py -- demonstrate using two I2S stereo DACs at once on RP2040 / Raspberry Pi Pico
# 19 May 2023 - @todbot / Tod Kurt
# video of this code: https://www.youtube.com/watch?v=CgqECxhqJEo
import time, board, audiocore, audiobusio
# qtpy rp2040 pins
# in this case, board.* names just match silkscreen, don't indicate functionality
lck1_pin, bck1_pin, dat1_pin = board.MISO, board.MOSI, board.SCK
lck2_pin, bck2_pin, dat2_pin = board.SCL, board.SDA, board.TX
@dglaude
dglaude / notes.md
Created September 24, 2022 21:24
USB Host in CircuitPython
@dglaude
dglaude / adafruit_st25dv16.py
Created December 20, 2021 00:55
Writing URI into st25dv16 from CircuitPython
# SPDX-FileCopyrightText: Copyright (c) 2021 Tim Cocks for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_st25dv16`
================================================================================
CircuitPython driver for the I2C EEPROM of the Adafruit ST25DV16 Breakout
@bmcbm
bmcbm / setup-nvdia-suspend.sh
Last active April 4, 2025 07:32
NVIDIA Suspend fix
# Use systemd for managing NVIDIA driver suspend in drivers ====>>> PRIOR to version 470 <<<=====
# https://download.nvidia.com/XFree86/Linux-x86_64/450.66/README/powermanagement.html
# https://forums.developer.nvidia.com/t/unable-to-set-nvidia-kernel-module-parameters/161306
# Please note: In Fedora Linux you may need to just install the xorg-x11-drv-nvidia-power pakage
# as sugested by @goombah88 in the comments below.
TMP_PATH=/var/tmp
TMPL_PATH=/usr/share/doc/nvidia-driver-460/
echo "options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=${TMP_PATH}" | sudo tee /etc/modprobe.d/nvidia-power-management.conf
@avoidik
avoidik / README.md
Last active June 30, 2024 17:29
Build Squid on Raspberry Pi with enabled SSL, SARG, SquidClamAV

Build Squid on Raspberry Pi with enabled SSL, optionally realtime SARG statistics and SquidClamAV

This is the short guide about how to recompile/enable --enable-ssl option in a Squid caching proxy server. The --enable-ssl option turned off by default, to be able to use SslBump feature we have to turn it on. To my own surprise Squid was compiled not only without --enable-ssl flag, but also with GnuTLS due to GPL legal reasons.

Optionally enable:

Squid

@emxsys
emxsys / raspberry_pi_script_as_service.md
Last active January 28, 2025 14:42
How to run a python script as a service in Raspberry Pi - Raspbian Jessie

How to Run a Script as a Service in Raspberry Pi - Raspbian Jessie

By: Diego Acuña

Original Article: http://www.diegoacuna.me/how-to-run-a-script-as-a-service-in-raspberry-pi-raspbian-jessie/

A pretty common task when using this device, is to run some script (for example a python script) as a service in the operating system so it can start on boot, stop and restart using systemctl and more. In this post I'm going to explain how to set a little script as a service using Raspbian Jessie in a Raspberry Pi.

Example Python Script

@SeppPenner
SeppPenner / Installing Python 3.7.4 on Raspbian.rst
Last active May 9, 2024 21:52
Installing Python 3.7.4 on Raspbian

Installing Python 3.7.4 on Raspbian

As of July 2018, Raspbian does not yet include the latest Python release, Python 3.7.4. This means we will have to build it ourselves, and here is how to do it.

  1. Install the required build-tools (some might already be installed on your system).