Skip to content

Instantly share code, notes, and snippets.

View cversek's full-sized avatar

Craig Versek cversek

  • Northeastern University
  • Boston, MA
View GitHub Profile
@cversek
cversek / AICD_00_README.md
Last active March 31, 2025 02:22
AI Context Dump (AICD): initialize a chatbot session instantly with comprehensive knowledge of your code base!

AI Context Dump (AICD)

This script generates a comprehensive project context dump, including your project's structure, file contents, and optionally Git history, enabling detailed analysis by AI chatbot models (e.g., ChatGPT, Bard, Bing Chat, Claude, etc.). The generated context file (DUMP_FROM_AICD_<datetime>.txt) is timestamped to ensure uniqueness.

NOTE: Compatible with Mac and Unix-style command-line environments. Requires standard Unix utilities and potentially jq and git. Windows PowerShell support is not currently available.

Features

  • Directory Tree: Outputs your project's directory structure using tree if available (attempts to respect AICD_ignore by name), falling back to find.
  • File Contents: Dumps contents of text-based files (source code, config files, etc.).
@cversek
cversek / arduino_dds_sin_cpu.ino
Last active January 12, 2024 20:27
Generic CPU driven Direct Digital Synthesis Sine Wave code for Arduino, tested with STM32F405 Feather board
#define NS 64
// Sine Wave Look-Up-Table, generated in Python:
/*
from numpy import *
bits = 12
samps = 64
A = 2**(bits-1)
X = linspace(0.0,1.0,samps)
Y = A*sin(2*pi*X) + A
#include <STM32FreeRTOS.h>
//NOTE the DRIVER_PIN is connected to the INTERRUPT_PIN via a wire
const int INTERRUPT_PIN = 11;
const int DRIVER_PIN = 13;
const int DRIVER_TASK_DELAY_MILLIS = 2;
const int DRIVER_TASK_RANDOM_BLOCKING_MICROS_MAX = 2000;
const int COMPETING_TASK_DELAY_MILLIS = 10; //decreasing this brings fault on faster
@cversek
cversek / frQueueRecvTimeout.ino
Created May 12, 2023 16:35
check behavior of FreeRTOS QueueReceive Timeout
#include <STM32FreeRTOS.h>
// Define the LED pin is attached
const uint8_t LED_PIN = LED_BUILTIN;
// We need a handle for ul
xTaskHandle waitTaskHandle = NULL;
QueueHandle_t mQueue;
@cversek
cversek / rocket.scad
Created April 29, 2021 05:54
3D printable near flight ready model rocket
// Estes 1/4A3-3T model rocket engine
ENGINE_DIAMETER = 13;
ENGINE_HEIGHT = 45;
// how far engines sticks out of bottom
ENGINE_OFFSET = 5;
// structural wall thickness
WALL_T = 1.0;
//material curing shrinkage compensation factor
@cversek
cversek / anagrams.py
Created December 24, 2020 07:06
Anagram generator
from operator import mul
from functools import reduce
PRIMES = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61,
67, 71, 73, 79, 83, 89, 97, 101]
LETTERS_BY_FREQ = list('esiarntolcdupmghbyfvkwzxqj')
LETTER_TO_PRIME = dict(zip(LETTERS_BY_FREQ,PRIMES))
def ppencode(letter_str):
return reduce(mul,map(lambda l: LETTER_TO_PRIME.get(l,1),letter_str))
@cversek
cversek / gen_polar_checks.py
Last active February 23, 2018 05:26
Simple python script to generate polar checked stimuli patterns.
import numpy as np
from scipy.misc import imsave
PIXELS_X = 256
PIXELS_Y = PIXELS_X
COLOR_SOLID_WHITE = (255,255,255,255)
COLOR_SOLID_BLACK = (0,0,0,255)
COLOR_FULLY_TRANSPARENT_BLACK = (0,0,0,0)
@cversek
cversek / code.py
Last active December 31, 2017 07:14
This is a modified CircuitPlayground demo, original is here: https://learn.adafruit.com/adafruit-circuit-playground-express/playground-sound-meter. The main modification is to only "detect" when the current magnitude of the mic is above a running average value by some multiplier > 1 (here we used 2.0).
# The MIT License (MIT)
#
# Copyright (c) 2017 Dan Halbert for Adafruit Industries
# Copyright (c) 2017 Kattni Rembor, Tony DiCola for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@cversek
cversek / code.py
Last active December 29, 2017 04:02
Start of a Morse Code lab... I basically smashed two Adafruit guide demos together. Transition state machine approach now calls sample.play and sample.stop at the right times.
from digitalio import DigitalInOut, Direction, Pull
import audioio
import board
import array
import time
import math
FREQUENCY = 440 # 440 Hz middle 'A'
SAMPLERATE = 8000 # 8000 samples/second, recommended!
import numpy as np
def speedx(sound_array, factor):
""" Multiplies the sound's speed by some `factor` """
indices = np.round( np.arange(0, len(sound_array), factor) )
indices = indices[indices < len(sound_array)].astype(int)
return sound_array[ indices.astype(int) ]
def stretch(sound_array, f, window_size, h):
""" Stretches the sound by a factor `f` """