Skip to content

Instantly share code, notes, and snippets.

@algrant
algrant / glitch-compound-optimiser.py
Created January 18, 2012 23:29
Glitch - Element/Compound Optimiser
RED = 0
GREEN = 1
BLUE = 2
SHINY = 3
SELLING = 0
SUGGESTED = 1
class Compound():
@algrant
algrant / selectframe.py
Created January 30, 2012 11:56
Screen Capture and Display Code
#!/usr/bin/env python
import sys, pygame
import ImageGrab
import ImageFilter
import ImageChops
import ImageMath
from numpy import array
pygame.init()
@algrant
algrant / tower_of_london.py
Created November 15, 2013 01:28
tower of london puzzle generator for Kyle
#!/usr/bin/env python
'''
Copyright (C) 2013 Al Grant, al@algrant.ca
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@algrant
algrant / caesar.py
Last active May 4, 2017 22:41
simple caesar shift in python
alphabet = 'abcdefghijklmnopqrstuvwxyz'
def shift(text, n):
answer = ''
for c in text:
if c in alphabet:
answer += alphabet[(alphabet.index(c)+n)%26]
continue
answer += c
return answer
@algrant
algrant / gameCore.js
Last active June 21, 2017 06:20
tic-tac-time
const { Map, List } = require('immutable');
const { createStore } = require('redux');
const { combineReducers } = require('redux-immutable');
// Constants
const TOGGLE_STARTING_PLAYER = 'gamecore/toggleStartingPlayer';
const PLACE_PIECE = 'gamecore/placePiece';
const TURN_PIECE = 'gamecore/turnPiece';
const MOVE_PIECE = 'gamecore/movePiece';
const SWITCH_PIECE_TURN = 'gamecore/switchPieceTime';
@algrant
algrant / esp32-cam_with_spi.ino
Created March 14, 2021 23:20
ESP-32-CAM with 3 MAX6657 temperature sensors. Custom pinouts for SPI
#include <SPI.h> // MAX6675 over hardware SPI
#define TC1_CS 12 // GPIO 12
#define TC2_CS 13 // GPIO 13
#define TC3_CS 15 // GPIO 15
/* Note: All MAX6675
* MAX6675 to EPS32
* VCC -> 3.3V
* GND -> GND
@algrant
algrant / asalato.py
Created September 28, 2022 00:26
ASCII - Asalato Rhythms (aka patica, kass-kass, kashaka)
# find two handed rhythms
# every char in pattern represents a beat, clicks can happen on or off beat.
patterns = {
# heli
"h": [0, 0],
# den den
"dd": [1, 0, 1, 0],
# air turn
"at": [1, 0, 0, 0],