Skip to content

Instantly share code, notes, and snippets.

View mattsedlar's full-sized avatar

Matt Sedlar mattsedlar

View GitHub Profile
@mattsedlar
mattsedlar / caesar.py
Created December 29, 2016 19:44
Simple Python script that encrypts text file using monoalphabetic substitution cypher
def encrypt_mono(file, key="key"):
'''This function encrypts text in a text file using a key and monoalphabetic substituion cypher'''
import string
def strip_punctuation(s):
return ''.join(c for c in s if c not in string.punctuation)
# remove repeating characters from key and add remaining letters of alphabet
alphabet = 'abcdefghijklmnopqrstuvwxyz'
library(ggplot2)
library(ggthemes)
# assigning notes and values centered around middle C
viola.notes = c(LETTERS[3:7],LETTERS[1:7],LETTERS[1:5])
viola.values = c(seq(-7,9,by=1))
violin.notes = c(LETTERS[7],LETTERS[1:7],LETTERS[1:7],LETTERS[1:2])
violin.values = c(seq(-3,13,by=1))
# script detailing process for weighted scores in Runner's World dataset
# reading in the csv containing the table
dat = read.csv("data/runners-world-data.csv")
# remove the ranking column since rows are id'd 1:x
dat = dat[,2:7]
# weights provided by Runner's World
weights = c(.4,.2,.2,.1,.1)
@mattsedlar
mattsedlar / game.R
Created August 3, 2016 16:52
Monty Hall Problem simulation script in R
doors = c(1:3)
tossout = function (x,y,z) {
if(x == y) {
return(sample(z[which(z!=x)],1))
} else { return(z[which(z!=x & z!=y)]) }
}
results = function(x,y) {
if(x!=y) { return(0) }