Skip to content

Instantly share code, notes, and snippets.

View drewcassidy's full-sized avatar
💭
🐇

Andrew Cassidy drewcassidy

💭
🐇
View GitHub Profile
@drewcassidy
drewcassidy / BinarySearch.java
Last active June 8, 2017 20:58
stupid binary search for my AP Computer Science class in High School
public class BinarySearch {
public int find(int[] arr, int v) {
int i = 0;
int b = (1 << (Double.doubleToLongBits(arr.length - 1) >> 51));
while ((b >>>= 1) > 0) {
if ((i | b) < arr.length && arr[i | b] <= v) i |= b;
if (arr[i] == v) return i;
}
@drewcassidy
drewcassidy / Deque.cs
Last active May 8, 2017 03:25
A Deque class written in C#. has no external dependencies!
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Voxelgon.Collections {
public class Deque<T> : ICollection<T> {
#region Fields

Keybase proof

I hereby claim:

  • I am drewcassidy on github.
  • I am drewcassidy (https://keybase.io/drewcassidy) on keybase.
  • I have a public key whose fingerprint is 4B68 3A9B 53E5 EC6B 5C2F B8F7 774E CFF4 464A C5CD

To claim this, I am signing this object:

@drewcassidy
drewcassidy / Doxyfile
Last active October 7, 2016 22:17
mbed-drivers doxygen
# Doxyfile 1.8.8
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a double hash (##) is considered a comment and is placed in
# front of the TAG it is preceding.
#
# All text after a single hash (#) is considered a comment and will be ignored.
# The format is:
@drewcassidy
drewcassidy / gen.py
Last active September 18, 2016 00:17
import os
dest = open("source/bitmaps.cpp", "w+")
head = open("source/bitmaps.h", "w+")
dest.write("#include \"bitmaps.h\"\n")
head.write("#ifndef BITMAPS_H\n#define BITMAPS_H\n")
for file in os.listdir("bitmaps"):
if file != ".DS_Store":
size = os.stat("bitmaps/" + file).st_size
@drewcassidy
drewcassidy / 16-04-20
Last active April 21, 2016 00:01
3D printer M501 logs
echo:Stored settings retrieved
echo:Steps per unit:
echo: M92 X75.33 Y79.29 Z2020.00 E98.00
echo:Maximum feedrates (mm/s):
echo: M203 X125.00 Y125.00 Z5.00 E14.00
echo:Maximum Acceleration (mm/s2):
echo: M201 X2000 Y2000 Z30 E10000
echo:Acceleration: S=acceleration, T=retract acceleration
echo: M204 S3000.00 T3000.00
echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)
@drewcassidy
drewcassidy / setbrightness
Created April 18, 2016 02:25
bash script to set the raspberry pi 7" LCD backlight. takes 1 argument from 0 to 255. place in /usr/bin
#!/bin/bash
echo $1 > /sys/class/backlight/rpi_backlight/brightness
import RPi.GPIO as GPIO
import random
import time
import sys
#global levelNum
GPIO.setmode(GPIO.BOARD)
GPIO.setup(21, GPIO.IN)
@drewcassidy
drewcassidy / gist:6143473
Created August 2, 2013 21:08
Traceback (most recent call last): File "simon.py", line 44, in <module> main() File "simon.py", line 43, in main level() File "simon.py", line 31, in level levelgen() File "simon.py", line 28, in levelgen levelNum += 1 UnboundLocalError: local variable 'levelNum' referenced before assignment
import RPi.GPIO as GPIO
import random
import time
levelNum = 0
#global levelNum
GPIO.setmode(GPIO.BOARD)
GPIO.setup(21, GPIO.IN)
<?xml version="1.0" encoding="utf-8"?>
<!--This file represents the results of running a test suite-->
<test-results name="Unity Tests" total="3" errors="0" failures="1" not-run="0" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2015-12-14" time="21:51:12">
<environment nunit-version="2.6.2-Unity" clr-version="2.0.50727.1433" os-version="Unix 15.2.0.0" platform="Unix" cwd="/Users/drewcassidy/Documents/Github/voxelgon" machine-name="Andrews-MacBook-Pro.local" user="root" user-domain="Andrews-MacBook-Pro.local" unity-version="5.3.0f4" unity-platform="Editor" />
<culture-info current-culture="en-US" current-uiculture="en-US" />
<test-suite name="voxelgon" type="Assembly" executed="True" result="Failure" success="False" time="0.064">
<results>
<test-case name="Voxelgon.MeshBuilder.Tests.MeshBuilderTests.TriangleContains" executed="True" result="Success" success="True" time="0.035">
</test-case>
<test-case name="Voxelgon.MeshBuilder.Tests.MeshBuilderTests.WindingOrder" execu