This file contains 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
from fractions import gcd | |
import copy | |
def get_relative_primes(number): | |
# will hold all numbers that are relatively prime to number | |
rel_primes = set() | |
# Dictionary: key is primitive root | |
# value is the set of powers mod number |
This file contains 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 java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
public class PRNG { | |
private long seed = 0; | |
private final long mod = Integer.MAX_VALUE, | |
seven_pow = (long)Math.pow(7, 5); | |
This file contains 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
from sys import stdout | |
rs = [] | |
qs = [' ',' '] | |
xs = [1,0] | |
ys = [0,1] | |
def gcd(a, b): | |
if(len(rs) is 0): | |
rs.append(a) |
This file contains 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 the math module (this will be used in Circle class) | |
import math | |
# created a generic shape class | |
class Shape: | |
# the function to initialize the shape | |
def __init__(self, width, height): | |
# the properties of the shape | |
self.width = width | |
self.height = height |
This file contains 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
# Example of using turtle, python's built-in graphics module | |
# import turtle with a new name | |
# who wants to write out t-u-r-t-l-e that many times? | |
import turtle as t | |
t.speed(5) # speed | |
t.pensize(5) # thickness | |
# convenience method for drawing circles |
This file contains 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
test |
This file contains 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 <LiquidCrystal.h> | |
// select the pins used on the LCD panel | |
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); | |
// define some values used by the panel and buttons | |
#define btnRIGHT 0 | |
#define btnUP 1 | |
#define btnDOWN 2 | |
#define btnLEFT 3 |
This file contains 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
/* HC-SR04 Sensor | |
https://www.dealextreme.com/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696 | |
This sketch reads a HC-SR04 ultrasonic rangefinder and returns the | |
distance to the closest object in range. To do this, it sends a pulse | |
to the sensor to initiate a reading, then listens for a pulse | |
to return. The length of the returning pulse is proportional to | |
the distance of the object from the sensor. | |
The circuit: |
This file contains 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
FROM node:latest | |
MAINTAINER Dustin Schie, [email protected] | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
COPY package.json /usr/src/app/ | |
RUN npm install |
This file contains 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 parseSearchString () { | |
var qs = window.location.search | |
qs = qs.replace(/^\?/,'') | |
var parts = qs.split('&') | |
var params = {} | |
parts.forEach(function (part) { | |
var pair = part.split('=') | |
params[pair[0]] = decodeURIComponent(pair[1]) | |
}) | |
return params |
OlderNewer