Skip to content

Instantly share code, notes, and snippets.

View unbibium's full-sized avatar

Nick Bensema unbibium

View GitHub Profile
@unbibium
unbibium / gist:6472677
Last active March 8, 2016 20:55
I'm trying to get ManyCam to switch to my FaceTime camera. It activates ManyCam, and makes sure the Cameras menu is expanded, and even makes FaceTime LOOK selected, but I can't get it to actually switch the input to FaceTime. If I get this working, I'll be able to write another one for a second input, and be able to switch between the two with s…
activate application "ManyCam"
global targetPosition
tell application "System Events" to tell window 1 of process "ManyCam"
click radio button "Sources" of radio group 1
local cameraGroupRow
local cameraGroup
local StillImageRow
local clickme
@unbibium
unbibium / interlacedScroll.c
Last active August 29, 2015 14:10
Interlaced scrolling with NeoPixel+Arduino proof of concept
// Proof of concept for using horizontal interlacing with scrolling text to improve resolution.
#include <Adafruit_GFX.h>
#include <gamma.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
@unbibium
unbibium / geb12bug.groovy
Last active October 5, 2015 18:11
Demonstration of module failure in Geb 0.12.2
import geb.spock.GebReportingSpec
import groovy.util.logging.Log4j2
import geb.Module
import geb.Page
/**
* The old 0.10.0 module syntax doesn't work in 0.12.2, failing apparently
* because the Geb code still contains a getPage() call.
*
@unbibium
unbibium / c64maththing.asm
Created October 18, 2018 23:05
Working out how to advance to the next row on a commodore 64 bitmap
;
; in an atari 8-bit routine that deals with bitmaps on a 320x192 screen, this is all you need
; to advance to the next row
lda ptr1
clc
adc #40
sta ptr1
bcc :+
inc ptr1+1
;
@unbibium
unbibium / matrix.a65
Created February 25, 2019 06:27
Matrix rain effect for Commodore 64 and unexpanded Vic 20
processor 6502
; This is supposed to generate a Matrix code rain effect.
;
; It is designed to be run inside a loop in BASIC, so that
; RUN/STOP and keyboard checks can be done from BASIC.
; For the C64 $C000 build, for example, you could do
; something like this:
; FOR X=1 TO 3000:SYS 49152:NEXT X
;
@unbibium
unbibium / pd.py
Created June 30, 2019 03:46
Monty Python death server experiment with C64 receiver
#!/usr/local/bin/python3
#
# Usage: { sleep 2; ./pd.py; } | nc c64-address.lan 6400
#
# Open up CCGMS 2019 in ASCII mode and the wifi modem
# will receive everything.
from dead import *
import time
import sys
@unbibium
unbibium / README.md
Created October 24, 2020 05:17
Cool screen hack for Commodore 64 in BASIC

Although I grew up with the Commodore 64, I didn't do very much graphics programming on it. So when I actually tried to, I was surprised by the quirk of the VIC-II chip that there were blocks of RAM that were essentially invisible to the VIC-II chip because it always mapped the character set ROM there. This ROM only made sense as a character set, but you could also see it in bitmap mode, in sprites, and even in screen memory.

I'd never seen it in screen memory, but today I decided to see if I could. I looked up what I needed to online, typed POKE 53272,69, and there it was, five columns of strange patterns, with 125 PETSCII character glyphs each rendered as eight PETSCII glyphs. You could kind of work out how the top row must map to @ABCD, how the right side or that row kind of showed the same symmetry as the letters B, C, and D did. It was a tenuous resemblance at best, but it was there.

@unbibium
unbibium / 2020-3a.py
Created December 11, 2020 22:17
Advent of Code day 3 solution
#!/usr/bin/env python3
print("tmap")
import os,sys,re
class Grid:
def __init__(self, fn):
self.trees = set()
@unbibium
unbibium / recursive22.py
Created December 22, 2020 22:51
AoC 2020 day 22 part 2 solution that still works if you add a third player
#!/usr/bin/env python3
print("22: recursive combat")
# I tried to program this without admitting that there
# are only two players.
import sys, os,math
from collections import deque, defaultdict
@unbibium
unbibium / aoc2021d5.py
Created December 5, 2021 15:08
AoC 2021 day 5
#!/usr/bin/env python3
#
# https://adventofcode.com/2021/day/5
def walk(start,end):
if (start > end):
return range(start,end-1,-1)
return range(start,end+1)
class Segment: