Skip to content

Instantly share code, notes, and snippets.

@Michael0x2a
Michael0x2a / utilities.py
Created March 6, 2013 00:45
Example code of drawing graphs and such
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import sympy
import matplotlib
import matplotlib.pyplot as pyplot
S = sympy.sympify
class Test(object):
def __getattr__(self, attr):
print("hi!")
print(attr)
return self.default_func
def __setattr__(self, attr, value):
print("bye!")
print(attr)
print(value)
@Michael0x2a
Michael0x2a / diagrams.py
Last active December 14, 2015 22:38
This gist contains the code used to generate all the graphs and data used in my 2013 Mathematics IA project ("Patterns from Complex Numbers"). utilities.py contains various helper functions and classes. diagrams.py contains the code used to render the drawings and run test data. This code has been confirmed to work using Python 2.7.3, matplotlib…
#!/usr/bin/env python
'''
Contains code to generate the graphs and data used in this IA
'''
from __future__ import division
import cmath
import utilities
@Michael0x2a
Michael0x2a / gist:5381707
Last active December 16, 2015 05:08
A study guide for the PSCSTA programming competition, and a review of some interesting features of Python in general.
{
"metadata": {
"name": "study-guide"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@Michael0x2a
Michael0x2a / test_adventure_example.py
Last active December 19, 2015 17:29
An example of a short text-adventure game.
has_paper = False
has_doll = False
def drums():
print "The drums are drummable"
def paper():
if has_paper == True:
print "You already have the paper"
@Michael0x2a
Michael0x2a / lesson-4
Created July 23, 2013 03:06
Programming Lessons 2013: Lesson 4, Lists
{
"metadata": {
"name": "lesson-4"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@Michael0x2a
Michael0x2a / webassign_6-7.ipynb
Last active December 25, 2015 01:29
Webassign 6, problem 7 walkthrough
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include "WPILib.h"
class RobotDemo : public SimpleRobot
{
private:
RobotDrive myRobot;
Joystick stick;
public:
RobotDemo(void):
import SimpleCV as scv
import pygame
import sys
BLACK = (0, 0, 0)
RED = (255, 0, 0)
SCALE = 0.25
cam = scv.Camera()