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/env/ruby | |
#Reddit Daily Programmer 207 | |
#Includes bonus. | |
#Function for parsing a protein sequence. | |
def proteins(dna) | |
#Create hash for the codons. | |
codons = {"TTT"=>"Phe","TTC"=>"Phe","TTA"=>"Leu","TTG"=>"Leu","TCT"=>"Ser","TCC"=>"Ser","TCA"=>"Ser","TCG"=>"Ser","TAT"=>"Tyr","TAC"=>"Tyr","TAA"=>"STOP","TAG"=>"STOP","TGT"=>"Cys","TGC"=>"Cys","TGA"=>"STOP","TGG"=>"Trp","CTT"=>"Leu","CTC"=>"Leu","CTA"=>"Leu","CTG"=>"Leu","CCT"=>"Pro","CCC"=>"Pro","CCA"=>"Pro","CCG"=>"Pro","CAT"=>"His","CAC"=>"His","CAA"=>"Gln","CAG"=>"Gln","CGT"=>"Arg","CGC"=>"Arg","CGA"=>"Arg","CGG"=>"Arg","ATT"=>"Ile","ATC"=>"Ile","ATA"=>"Ile","ATG"=>"Met","ACT"=>"Thr","ACC"=>"Thr","ACA"=>"Thr","ACG"=>"Thr","AAT"=>"Asn","AAC"=>"Asn","AAA"=>"Lys","AAG"=>"Lys","AGT"=>"Ser","AGC"=>"Ser","AGA"=>"Arg","AGG"=>"Arg","GTT"=>"Val","GTC"=>"Val","GTA"=>"Val","GTG"=>"Val","GCT"=>"Ala","GCC"=>"Ala","GCA"=>"Ala","GCG"=>"Ala","GAT"=>"Asp","GAC"=>"Asp","GAA"=>"Glu","GAG"=>"Glu","GGT"=>"Gly","GGC"=>"Gly","GGA"=>"Gly","GGG"=>"Gly"} | |
#Now loop through. |
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
$failCounter = 0 | |
$phrases = ("Process Kill!", "Double Process!", "Triple Process!", "Processtacular!", "Process Frenzy!", "Proctrocity!", "Procemanjaro!") | |
while($true) | |
{ | |
#Query all processes. | |
$processes = Get-Process | |
$counter = 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
#!/usr/bin/ruby | |
#Reddit Daily Programmer 208 | |
#http://www.reddit.com/r/dailyprogrammer/comments/30ubcl/20150330_challenge_208_easy_culling_numbers/ | |
puts "Enter your numbers." | |
print "> " | |
input = $stdin.gets.chomp | |
input_array = input.split(" ") | |
#Get the unique values. | |
uniques = input_array.uniq |
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
#Reddit Daily Programmer #210 - http://www.reddit.com/r/dailyprogrammer/comments/32goj8/20150413_challenge_210_easy_intharmonycom/ | |
#Function to append zeros. | |
function ConvertToBinary | |
{ | |
param($integer) | |
return [Convert]::ToString($integer, 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
#!/usr/env/ruby | |
#http://www.reddit.com/r/dailyprogrammer/comments/35l5eo/20150511_challenge_214_easy_calculating_the/ | |
#values = [5, 6, 11, 13, 19, 20, 25, 26, 28, 37] | |
values = [37, 81, 86, 91, 97, 108, 109, 112, 112, 114, 115, 117, 121, 123, 141] | |
sum = 0 | |
mid_sum = 0 | |
#Calculate the mean. | |
values.each do |x| | |
sum += x |
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
#Reddit Daily Programmer #217 - http://www.reddit.com/r/dailyprogrammer/comments/3840rp/20150601_challenge_217_easy_lumberjack_pile/ | |
#Define the parameters of the piles. | |
<# | |
$grid = 3 | |
$logs = 7 | |
$stacks = @(@(1, 1, 1), @(2, 1, 3), @(1, 4, 1)) | |
#> | |
<# | |
$grid = 4 |
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
#http://www.reddit.com/r/dailyprogrammer/comments/38yy9s/20150608_challenge_218_easy_making_numbers/ | |
#Function to see if the number is already a palindrome or not. | |
function IsPalindrome | |
{ | |
param($num) | |
#Find the length. | |
$len = ([string]$num).Length | |
#Check it. |
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/env/ruby | |
#Function to test if the current value is a palindrome! | |
def is_palindrome(num) | |
len = num.to_s.length | |
numArr = num.to_s.split("") | |
is_pal = true | |
#Loop through the array, comparing the beginning to the end. | |
for i in 0...len/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
#!/usr/env/ruby | |
#Defining the object for my list. | |
class Todo | |
#Just create an empty array off the bat. | |
def initialize | |
@list = Array.new | |
end | |
#Function to add new items. |
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 Lulz | |
{ | |
param([REF]$Stuff) | |
$Stuff.Value *= 5 | |
} | |
$nonsense = 5 | |
Lulz -Stuff ([REF]$nonsense) | |
Write-Host $nonsense |