Skip to content

Instantly share code, notes, and snippets.

@johnholbrook
johnholbrook / FibFinder
Created July 7, 2013 02:36
Applescript Fibonacci FInder
set f1 to 1
set f2 to 2
set numToCalc to text returned of (display dialog "Which fibonacci number should I calculate?" default answer "")
if numToCalc is less than or equal to 2 then
display dialog "Error! Pick a whole number larger than 2!"
error number -128
end if
set repeatcount to numToCalc - 2
repeat repeatcount times
set fn to f1 + f2
set bottles to 100
display dialog "ready?" buttons {"yes", "yes"}
repeat 5 times
delay 1
beep
end repeat
repeat until bottles = 0
tell application "System Events"
keystroke (bottles & "bottles of beer on the wall")
keystroke return
repeat 5 times
beep
delay 1
end repeat
set ecount to 1
repeat 20 times
tell application "System Events"
repeat ecount times
keystroke "e"
end repeat
@johnholbrook
johnholbrook / Sqrt.py
Last active December 29, 2015 05:39
compares number of length n to the first n digits of sqrt(n). if they are identical, adds n to a list.
print "importing"
from math import sqrt
print "done importing"
def compare(num, root):
length = len(str(num))
print length
part = root[:length]
if part == num:
return True
time := FormatTime, CurrentDateTime,, yyyy-MM-dd HHmm
log := "`n Script run on %time%"
FileAppend, %log%, C:\Users\Administrator\Documents\IP\runtimelog.txt
@johnholbrook
johnholbrook / RCXSmoothFollow.c
Created February 19, 2015 01:16
A proportional line follower written in ROBOTC for LEGO Mindstorms RCX
#pragma config(Sensor, S1, touch, sensorTouch)
#pragma config(Sensor, S3, light, sensorReflection)
#pragma config(Motor, motorA, left, tmotorNormal, openLoop, reversed)
#pragma config(Motor, motorC, right, tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
int darkVal;
int lightVal;
@johnholbrook
johnholbrook / calc.c
Created March 5, 2015 17:32
A basic four-function calculator written in ROBOTC for RCX. Video at http://youtu.be/Wa_-ehRMjs0
#pragma config(Sensor, S1, select, sensorTouch)
#pragma config(Sensor, S2, dial, sensorRotation)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
SensorValue[dial] = 0; //set first number
bool choosing;
choosing = true;
int num1;
--- Physical volume ---
PV Name /dev/mmcblk0p3
VG Name ev3devVG
PV Size 6.52 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 1669
Free PE 0
Allocated PE 1669
PV UUID 8JaI65-Nm1A-5IDC-9s3G-JY4p-sHKQ-66FjUJ
Hi all,
Three weeks from today, we depart for Wisconsin. We're still meeting every Saturday, from 9:00 to 12:00 (and often later, on build events), in Strait's room. I want to stress the importance of attending these meetings as much as possible in the weeks approaching the tournament. Even if you have no build events, even if you have not prepared very much, even if your partner(s) may not be there, you should still come to the meetings. In the remaining meetings, we have important information and plans to discuss, forms to distribute and fill out, etc. So we look forward to seeing you this Saturday and on subsequent Saturdays.
If you won't be able to come to Saturday's meeting, please let us know ASAP. We're counting on all of you to be there.
/************************************************************
Joystick Dead-zone Example Code
John Holbrook, December 2016
Writen for VRC 8768, Huntington High School
************************************************************/
//set the radius here (put this near the top of your file)
#define DEAD_ZONE_RADIUS 20
task main()
{