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
require 'json' | |
TRUELOOKFORWARD = true | |
LOOKFORWARD = 2 #how many words forward it generates from a seed word | |
def prepareString(str) | |
#return str.downcase.split(/(\W)+/).map{|word| word.gsub(/\s+/, "")}.reject{|word| word == ""} to remind you what it was | |
return str.split("").push("").unshift("") | |
end |
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/ruby | |
`mkdir mean-letters` | |
`mkdir final-letters` | |
('a'..'z').each do |letter| | |
puts "layering #{letter}" | |
`convert letters/#{letter}/* -evaluate-sequence mean mean-letters/#{letter}.png` | |
`convert mean-letters/#{letter}.png -threshold 65% final-letters/#{letter}.png` | |
end |
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
#a person will have, averagely, around double the specified value | |
#because when it's generated, everyone has to be friends with those | |
#who are friends with them | |
AMOUNT_OF_FRIENDS = 1 | |
FRIEND_VARIANCE = 4 | |
POPULATION = 7400 #7.4 billion in 1000's | |
def a(n) | |
if n <= 1 | |
1 |
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
table = {} | |
DATA.read.split(?\n).each do |line| | |
ps = line.split(/\s+/) | |
table[ps[2]] = ps[0].to_f | |
end | |
loop do | |
i = gets.chomp | |
input = i.scan(/([A-Z][a-z]?)([0-9]?)/) | |
mass = 0 | |
input.each do |element| |
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
#lang racket | |
(require racket/draw) | |
(define HEIGHT 200) | |
(define WIDTH 400) | |
(define UNIT_PER_PIXEL 0.012) | |
(define HEIGHT/2 (/ HEIGHT 2)) | |
(define WIDTH/2 (/ WIDTH 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
module CLN where | |
import Data.List | |
data CLNElem = Dot | Parens [CLNElem] | |
instance (Show CLNElem) where | |
show Dot = "." | |
show (Parens clnes) = "(" ++ (concatMap show clnes) ++ ")" | |
newtype CLN = CLN [CLNElem] | |
instance (Show CLN) where |
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
template<std::vector<std::string>* arg, std::string_view* flag, std::function<void()>* f> | |
struct CommandLineLambda { | |
//returns whether or not the argument was called | |
static inline bool runArg() { | |
auto iter = std::find(arg->begin(), arg->end(), *flag); | |
if (iter != arg->end()) { | |
(*f)(); | |
return true; | |
} | |
return false; |
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
module Functions where | |
import SExpr | |
mathF :: (Integer -> Integer -> Integer) -> String -> Literal -> Literal -> Literal | |
mathF op s (LNum a) (LNum b) = LNum $ a `op` b | |
mathF _ s _ _ = error $ "Non number passed to " ++ s | |
addF :: Literal -> Literal -> Literal | |
addF a b = mathF (+) "+" a b |
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
""" | |
Filename: genome.py | |
Author: Tyler | |
Purpose: Construct phylogenetic trees. | |
""" | |
# ;; Consider this my final hoorah before dropping my CS major. | |
# ;; https://xkcd.com/224/ | |
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
{-# LANGUAGE ViewPatterns #-} | |
import Data.List | |
dropPieces :: [String] -> [String] | |
dropPieces (top:mid:rows) = | |
let willDrop = zipWith (\t m -> m == '-' && t /= '-') top mid | |
newTopRow = (\(t,m,w) -> if w then '-' else t) <$> (zip3 top mid willDrop) | |
newMidRow = (\(t,m,w) -> if w then t else m) <$> (zip3 top mid willDrop) | |
in |