Skip to content

Instantly share code, notes, and snippets.

@jondoesntgit
jondoesntgit / hw1part01.md
Created September 14, 2015 13:58
Homework 01 Due 23:55 on 150914
  1. (10 pts) Suppose we are comparing implementations of two different sorting algorithms, insertion sort and merge sort. For inputs of size n, insertion sort runs in 8n2 steps, while merge sort requires 64n lg n steps. For which values of n does insertion sort beat merge sort.
@jondoesntgit
jondoesntgit / chickens_in_space.py
Last active November 3, 2015 15:12
Chickens in Space
from scene import *
import random
from numpy import sign as sgn
score= 0
chandr=20
decayRate = 100 # higher is slower
spew = .1
leng=-100
gconst = 1
@jondoesntgit
jondoesntgit / phase.md
Last active January 8, 2016 00:57
Phase Modulation

ANU Filter Report

#Impacts of Noise Distortion and Interference

#Waveform

time domain

frequency domain #Waveform Equation

@jondoesntgit
jondoesntgit / morse2ascii.c
Created February 12, 2016 01:50
Morse code to ASCII
// PseudoCode
@jondoesntgit
jondoesntgit / morse2ascii.c
Created February 12, 2016 18:56
Morse2Ascii code for ENGR455
struct UpperLower {
int shortest_dah;
int longest_dit;
};
/**
* @author Jonathan Wheeler
* @date 11 February 2016
*
* Accepts a digital input taken from a photodiode.
@jondoesntgit
jondoesntgit / download.php
Last active February 18, 2016 02:22
Email Grabber
<?php
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment;filename=email.txt");
header("Content-Transfer-Encoding: binary ");
@jondoesntgit
jondoesntgit / writeRaspbianToSDcard.sh
Created August 16, 2016 19:08
Write Raspbian to an SD card script
#!/bin/bash
# Check to see if raspbian exists on hard drive
ls *raspbian*.img >/dev/null 2> /dev/null
if [ "$?" -eq "1" ]; then
# file not found
raspbianFileName='raspbian.img'
else
# file found
raspbianFileName=$(ls *raspbian*.img | head -n1) > /dev/null
fi
@jondoesntgit
jondoesntgit / crosswalk.ino
Created August 16, 2016 19:38
Crosswalk Arduino
#include <Servo.h>
// Power pin is normally OFF
// Walk pin is normall ON
int walkPin = 2;
int powerPin = 3;
int togglePin = 3;
int bellPin = 12;
@jondoesntgit
jondoesntgit / Untitled.ipynb
Last active December 5, 2016 23:43
IPython example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jondoesntgit
jondoesntgit / 24.py
Created December 8, 2017 01:54
Script for finding all solutions to the card game "24"
import numpy as np
def combine(*args):
if len(args) == 2:
return np.concatenate([(x*y, x+y, abs(x-y), x/y, y/x) for x in args[0] for y in args[1]])
return np.concatenate([combine(combine(*np.roll(args, i)[1:]), np.roll(args,i)[0]) for i in range(len(args))])
vals = (np.arange(10) + 1).astype(np.float64)
for x in ("%i %i %i %i, %s" % (a,b,c,d, 24 in combine([a], [b], [c], [d])) for a in vals for b in vals for c in vals for d in vals if a <= b and b <= c and c <= d ):
print(x)
import numpy as np
def combine(*args):