Skip to content

Instantly share code, notes, and snippets.

@JFFail
JFFail / date-dilemma.ps1
Created December 17, 2015 15:35
Solution To Reddit Daily Programmer #245 Easy - Date Dilemma
#https://www.reddit.com/r/dailyprogrammer/comments/3wshp7/20151214_challenge_245_easy_date_dilemma/
#Solution to Reddit Daily Programmer 245 Easy.
#Function to parse from the user's specified format into a standard one.
#Void, dumps to STDOUT.
function ParseDate
{
param (
$UserFormat
)
@JFFail
JFFail / AbunDef.cs
Created November 30, 2015 21:12
Solution To Reddit Daily Programmer Easy #243 - Abundant and Deficient Numbers
using System;
using System.Collections;
//https://www.reddit.com/r/dailyprogrammer/comments/3uuhdk/20151130_challenge_243_easy_abundant_and/
//Reddit Daily Programmer Easy Challenge #243 - Abundant and Deficient Numbers
namespace AbunDef
{
class Program
{
@JFFail
JFFail / typoglycemia.cs
Created November 23, 2015 18:56
Reddit Daily Programmer #240 Easy - Typoglycemia
using System;
using System.Collections;
using System.IO;
using System.Text.RegularExpressions;
namespace Typoglycemia
{
class Program
{
static void Main(string[] args)
@JFFail
JFFail / gameOfThrees.cs
Created November 3, 2015 18:23
Solution To Reddit Daily Programmer #239 - A Game Of Threes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GameOfThrees
{
class Program
{
@JFFail
JFFail / hack-fallout.ps1
Last active July 31, 2020 22:08
Intermediate Reddit Daily Programmer 238 - Fallout Hacking Minigame
#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.
@JFFail
JFFail / make-words.ps1
Created October 26, 2015 20:03
Solution to Reddit Daily Programmer #238 - Consonants and Vowels
#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
@JFFail
JFFail / broken-keyboard.ps1
Created October 22, 2015 12:57
Reddit Daily Programmer #237 - Broken Keyboard
#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.
@JFFail
JFFail / calculate-ruthaaron.ps1
Created October 17, 2015 15:52
Reddit Daily Programmer #235 - Ruth-Aaron pairs
#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
@JFFail
JFFail / pick-tetromino.ps1
Created October 12, 2015 23:15
Reddit Daily Programmer #236 Solution
#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) {
@JFFail
JFFail / port-percent.sh
Last active July 31, 2020 22:08
Script to repeatedly check port availability on an endpoint. Takes server name and a port number as parameters.
#!/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