Skip to content

Instantly share code, notes, and snippets.

@cowdinosaur
cowdinosaur / generator.py
Created July 15, 2024 01:43
Certificate Generator
import pandas as pd
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from PyPDF2 import PdfWriter, PdfReader
import io
def create_certificate(name, base_pdf, output_pdf):
packet = io.BytesIO()
can = canvas.Canvas(packet, pagesize=A4)
# Set font and size
import time
from neopixel import Neopixel
NO_OF_LEDS = 12
pixelssec = Neopixel(8, 0, 1, "GRB")
pixelsmin1 = Neopixel(11, 2, 22, "GRB")
pixelsmin2 = Neopixel(12, 3, 18, "GRB")
rtc = machine.RTC()
WHITE = (80, 80, 80)
@cowdinosaur
cowdinosaur / neoexample.ino
Created April 8, 2022 07:53
Arduino Neopixel basic code
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 8
#define NUMPIXELS 16 // Popular NeoPixel ring size
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int pressed = 0;
vowels = 'aeiou'
consonants = 'bcdfghjklmnpqrstvwxyz'
sentence = "how do you say ... in pig latin?"
### YOUR CODE HERE!
def translate_word(word):
if len(word) >= 2:
if word[0] in consonants and word[1] in vowels:
word = word[1:] + word[:1] + "ay"
@cowdinosaur
cowdinosaur / slidepuzzle.py
Created July 30, 2021 03:13
Complete Slide Puzzle
# Slide Puzzle
# By Al Sweigart al@inventwithpython.com
# http://inventwithpython.com/pygame
# Released under a "Simplified BSD" license
import pygame, sys, random
from pygame.locals import *
# Create the constants (go ahead and experiment with different values)
BOARDWIDTH = 4 # number of columns in the board
@cowdinosaur
cowdinosaur / slidepuzzle.py
Created July 23, 2021 07:50
Starting template for Slide Puzzle
# Slide Puzzle
# By Al Sweigart al@inventwithpython.com
# http://inventwithpython.com/pygame
# Released under a "Simplified BSD" license
import pygame, sys, random
from pygame.locals import *
# Create the constants (go ahead and experiment with different values)
BOARDWIDTH = 4 # number of columns in the board
import random
HANGMANPICS = ['''
+---+
| |
|
|
|
|
=========''', '''
+---+
@cowdinosaur
cowdinosaur / nyp_spectrum.ino
Created October 8, 2020 04:53
NYP Spectrum DDR Step Input
#include <Adafruit_NeoPixel.h>
// Which pin is connected to the pressure sensors
#define STEP_UP_PIN A0
#define STEP_LEFT_PIN A1
#define STEP_DOWN_PIN A2
#define STEP_RIGHT_PIN A3
// Which pin is connected to the NeoPixels
#define LED_UP_PIN 2
@cowdinosaur
cowdinosaur / microbit_accelerometer_graph.pde
Created August 5, 2019 07:26
Microbit Accelerometer Dashboard
import processing.serial.*;
Serial port;
int x, y, z, strength;
void setup() {
printArray(Serial.list());
port = new Serial(this, Serial.list()[1], 115200);
port.bufferUntil(10);
size(700, 550);
textSize(32);
#include<IRremote.h> //including infrared remote header file
#define button_2 34935 //code for button 1
#define button_4 10455 //code for button 2
#define button_5 43095 //code for button 3
#define button_6 26775 //code for button 4
#define button_8 39015 //code for button 4
int RECV_PIN = 9; //IR receiver pin
IRrecv irrecv(RECV_PIN);