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
| """ | |
| This code computes pi. It's not the first python | |
| pi computation tool that I've written. This program | |
| is a good test of the mpi4py library, which is | |
| essentially a python wrapper to the C MPI library. | |
| To execute this code: | |
| mpiexec -np NUMBER_OF_PROCESSES -f NODES_FILE python mpipypi.py |
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
| import turtle | |
| import random | |
| import math | |
| def drawPolygon(myTurtle, sides, length): | |
| angle = 360 / sides | |
| for side in range(sides): | |
| myTurtle.forward(length) | |
| myTurtle.left(angle) |
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 | |
| import datetime | |
| import argparse | |
| import re | |
| def createDate(stringDate): | |
| if re.match("\d\d\d\d-\d\d-\d\d$", stringDate) is None: | |
| raise ValueError("This is not in the correct date format. Use YYYY-MM-DD") |
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
| print() | |
| print() | |
| print() | |
| print("D&D") | |
| totals = [0] * 19 | |
| for a in range(1, 7): | |
| for b in range(1, 7): | |
| for c in range(1, 7): |
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
| function D = dijkstra(G, pairs) | |
| % This function takes an adjacency matrix called G | |
| % and a p-by-2 matrix called pairs. | |
| % The pairs matrix will contain pairs of indices. | |
| % This function will determine the shortest distance from | |
| % the first index in the pair to the second index for | |
| % every pair in matrix pairs. | |
| % | |
| % The function will only return a p-by-1 matrix of shortest | |
| % distances. I could use it to also return the shortest path, |
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
| #include <unistd.h> | |
| int main(v,c) | |
| int v; | |
| char **c; | |
| { | |
| for(v[(*&c)++]="Hello, world!\n)"; | |
| (!!!!c)[*c] && (v-- || --(*&c) && execlp(*c, *c, c[!!c] + !!c, !c)); | |
| **c = !c) | |
| write(!!*c, **&c, !!**c); |
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
| class MyClass { | |
| myVar: string = "Hello "; | |
| greet(name: string) { | |
| return this.myVar + name; | |
| } | |
| } | |
| let x = new MyClass(); | |
| console.log(x.greet("James")); | |
| let y = x.greet; |
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 | |
| import subprocess | |
| import glob | |
| import os | |
| import os.path | |
| import sys | |
| def getProcessOutput(myCommand): | |
| call = subprocess.Popen(myCommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE) | |
| call.wait() |
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
| int needles = 0; | |
| int crossings = 0; | |
| int needleLength = 50; | |
| int linegap = 64; | |
| int min = 0 + needleLength; | |
| int max = width - needleLength; | |
| void setup() { | |
| size(640, 640); | |
| //frameRate(5); |
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
| " .vimrc | |
| " James's vim configuration file. | |
| " This configuration makes James happy to program. | |
| let mapleader=" " | |
| set autoindent | |
| set backspace=indent,start | |
| set nocompatible | |
| set expandtab |
NewerOlder