Instantly share code, notes, and snippets.

# JohnJFFail

• Sort options
Last active Oct 28, 2015
Intermediate Reddit Daily Programmer 238 - Fallout Hacking Minigame
View hack-fallout.ps1
 #https://www.reddit.com/r/dailyprogrammer/comments/3qjnil/20151028_challenge_238_intermediate_fallout/ #Reddit Daily Programmer 238 - Intermediate #Get the desired difficulty from the user. \$needDifficulty = \$true while(\$needDifficulty) { Write-Host "How difficult would you like the game to be?" \$difficulty = Read-Host "Enter a value (1 - 5)" #Validate the input by making sure it's a number.
Created Oct 26, 2015
Solution to Reddit Daily Programmer #238 - Consonants and Vowels
View make-words.ps1
 #https://www.reddit.com/r/dailyprogrammer/comments/3q9vpn/20151026_challenge_238_easy_consonants_and_vowels/ #Create random "words" based on a defined input pattern. #Define the alphabet. \$consonants= "b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z" \$vowels = "a","e","i","o","u" #Get input from the user. \$userInput = Read-Host "Enter the pattern" \$goodInput = \$true
Created Oct 22, 2015
Reddit Daily Programmer #237 - Broken Keyboard
View broken-keyboard.ps1
 #https://www.reddit.com/r/dailyprogrammer/comments/3pcb3i/20151019_challenge_237_easy_broken_keyboard/ #Import the list of words. \$wordList = Get-Content -Path .\word.txt #http://norvig.com/ngrams/enable1.txt #Get the first part of input, which is an integer. \$numbers = Read-Host "Enter the number of combinations to check" \$counter = 0 \$checkArray = @() #Loop through them to get all of the input.
Created Oct 17, 2015
Reddit Daily Programmer #235 - Ruth-Aaron pairs
View calculate-ruthaaron.ps1
 #Reddit Daily Programmer #235 #https://www.reddit.com/r/dailyprogrammer/comments/3nkanm/20151005_challenge_235_easy_ruthaaron_pairs/ #Function to figure out the factors. function GetFactors { param([int] \$number) \$results = @() \$counter = 2
Created Oct 12, 2015
Reddit Daily Programmer #236 Solution
View pick-tetromino.ps1
 #Reddit Daily Programmer 236. #https://www.reddit.com/r/dailyprogrammer/comments/3ofsyb/20151012_challenge_236_easy_random_bag_system/ #Initialize the array with all pieces. \$pieces = New-Object System.Collections.ArrayList \$counter = 0 \$result = "" #Pick the pieces. while(\$counter -lt 50) {
Last active Sep 25, 2015
Script to repeatedly check port availability on an endpoint. Takes server name and a port number as parameters.
View port-percent.sh
 #!/bin/bash if [[ \$# -ne 2 ]]; then echo "Please submit 2 arguments: server name and port number" else total=0 success=0 while true; do total=\$((total+1)) result=\$(nmap -Pn -p \$2 \$1 | grep "/tcp") echo -n \$result
Created Sep 15, 2015
Reddit Daily Programmer #232
View check-palindrome.ps1
 #https://www.reddit.com/r/dailyprogrammer/comments/3kx6oh/20150914_challenge_232_easy_palindromes/ \$lines = 2 \$counter = 0 \$text = "" while(\$counter -lt \$lines) { \$temp = Read-Host "Enter text" \$temp = \$temp.ToCharArray() foreach(\$letter in \$temp) { \$letter = [string]\$letter
Created Aug 25, 2015
Reddit Daily Programmer #229
View dottie-numbers.ps1
 #https://www.reddit.com/r/dailyprogrammer/comments/3i99w8/20150824_challenge_229_easy_the_dottie_number/ \$number = Read-Host "Enter a number" do { \$previous = \$number \$number = [math]::Cos(\$number) } while(\$number -ne \$previous) Write-Host \$number
Created Aug 19, 2015
Solution To Reddit Daily Programmer #228
View order-letters.ps1
 #https://www.reddit.com/r/dailyprogrammer/comments/3h9pde/20150817_challenge_228_easy_letters_in/ function CheckOrder { param(\$Word) #Place the word into an array. \$charArray = \$Word.ToCharArray() \$sortedArray = \$charArray | Sort-Object #See if they match. \$match = \$true
Last active Aug 29, 2015
PowerShell script to generate a random password of specified length and complexity.