This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
CHROMATIC_SCALE = deque(['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']) | |
MAJOR=[0, 2, 4, 5, 7, 9, 11] | |
MINOR=[0, 2, 3, 5, 7, 8, 10] | |
def printScaleLine(scale): | |
scaleOutputString='' | |
for x in scale: | |
scaleOutputString = scaleOutputString + x.ljust(3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<!-- | |
Performs a continuous FFT on the audio signal from the microphone and renders a simple | |
HTML bar chart every 50ms (although only if the signal is beyond a threshold). | |
License: MIT | |
--> | |
<head> | |
<title>Audio spectrum visualisation demo</title> | |
<style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def get_notes(): | |
return ['c', 'c#', 'd', 'd#', 'e', 'f', 'f#', 'g', 'g#', 'a', 'a#', 'b'] | |
def get_note_pair(): | |
x = random.choice(range(0, len(get_notes()) - 1)) | |
y = random.choice(range(x+1, len(get_notes()))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame as pg | |
import numpy as np | |
def is_exit_key(e): | |
return e.type == pg.KEYUP and (e.key == pg.K_ESCAPE or e.key == pg.K_q) | |
class GameObject: | |
def __init__(self, position, colour): | |
self.position = position |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
from PIL import ImageFont | |
from PIL import ImageDraw | |
import os | |
# The range of images to generate, which also controls the number of gradient 'stops' | |
imageCount = 30 | |
# How far to increment red for each image, currently tied to imageCount as you can see | |
colorIncrement = 255 / imageCount | |
# Output folder for the images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.define OAM_TABLE_START $0200 | |
; .zeropage | |
; param_1: .res 1 | |
; param_2: .res 1 | |
; param_3: .res 1 | |
; temp_var_1: .res 1 | |
; temp_var_2: .res 1 | |
; temp_var_3: .res 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Written for the CA65 assembler and tested on a NES emulator | |
.zeropage | |
counter_lsb: .res 1 | |
counter_msb: .res 1 | |
.proc RateLimit | |
lda #$EE ; Most Significant Byte 'interval' | |
sta counter_msb | |
LOOP_MSB: | |
lda #$00 ; Least Significant Byte 'interval' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lda #$00 | |
sta $a0 | |
lda #$00 | |
sta $a1 | |
LSB_INC: | |
ldy $a0 ; Debug, shows the LSB in the Y register | |
inc $a0 | |
BNE LSB_INC | |
LSB_RESET: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const updateOccurenceTable = (byteOccurenceTable, inputBuffer) => { | |
inputBuffer.forEach(character => { | |
const byteOccurenceAccumulator = byteOccurenceTable[character]; | |
byteOccurenceTable[character] = byteOccurenceAccumulator !== undefined ? byteOccurenceAccumulator + 1 : 1; | |
}); | |
const { total } = byteOccurenceTable; | |
byteOccurenceTable.total = total ? total + inputBuffer.length : inputBuffer.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# October 2018. | |
# Written by Lisa Burton. | |
# Provided under the terms of the MIT license. | |
STACK_NAME='<<< YOUR_CLOUD_FORMATION_STACK_NAME >>>' | |
SAM_INPUT_TEMPLATE='<<< YOUR_SAM_FILE_HERE >>>' | |
SAM_OUTPUT_TEMPLATE='outputSamTemplate.yaml' | |
SAM_S3_BUCKET='<<< YOUR_S3_BUCKET_NAME >>>' |
NewerOlder