This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script is meant to streamline the installation of pybrain with | |
# support for ODE enviroments on the OS X operating system. | |
# | |
# To run: | |
# source pybrain-ode-setup.sh | |
# | |
# Requirements: | |
# * pip -- easy_install pip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
def crc(msg, div, code='000'): | |
"""Cyclic Redundancy Check | |
Generates an error detecting code based on an inputted message | |
and divisor in the form of a polynomial representation. | |
Arguments: | |
msg: The input message of which to generate the output code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To install virtualenv via pip | |
$ pip3 install virtualenv | |
Note that virtualenv installs to the python3 directory. For me it's: | |
$ /usr/local/share/python3/virtualenv | |
Create a virtualenvs directory to store all virtual environments | |
$ mkdir somewhere/virtualenvs | |
Make a new virtual environment with no packages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# name: msg_to_img | |
# | |
# description: a simple program for converting a binary string of values | |
# and decyphering that string into a matrix form using its factors | |
# | |
# author: evan sneath | |
# date: 5/28/2012 | |
# license: This software licensed under the Open Software License version 3.0: | |
# http://www.opensource.org/licenses/OSL-3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def palindromes(min, max): | |
"""Finds the largest palindrome of the product of two numbers between an desired range. | |
Arguments: | |
min: Minimum value limit. | |
max: Maximum value limit. | |
Returns: | |
Largest palindrome of the product of two numbers between the established range. | |
""" | |
a, b, product, highest = min, min, 0, 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def nth_prime(n): | |
"""Finds the nth prime number. | |
Arguments: | |
n: The index of the saught after prime number. | |
Returns: | |
The value of the nth prime number. | |
""" | |
prime_table, counter = [], 2 | |
prime_number, top, last = 0, 10000000, 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pythagorean_triples(n): | |
"""Finds a, b, and c such that a + b + c = n and a^2 + b^2 = c^2. | |
Arguments: | |
n: Value from which to determine pythagorean triples. | |
Returns: | |
Resulting combination of a, b, and c to satisfy the formula. | |
""" | |
a, b = 1, 1 | |
while (a < n // 2): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tiny_fibonacci(n): | |
# A very small Fibonacci sequence generator which prints 'n' values of the sequence. | |
a, b = 0, 1 | |
(1..n).each{puts b; a, b = b, b + a} | |
end |