Skip to content

Instantly share code, notes, and snippets.

John JFFail

Block or report user

Report or block JFFail

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JFFail
JFFail / gist:6442b27225eb71b30d26
Created Jan 6, 2015
Script to pull the end of netlogon.log files on a list of DCs to check for entries in the last two months.
View gist:6442b27225eb71b30d26
#Get the list of servers.
$serverList = Get-Content -Path .\servers.txt
#Loop through each.
foreach($server in $serverList) {
#Get the contents of the netlogon file.
$netlogonContent = Get-Content -Path \\$server\C$\Windows\debug\netlogon.log -Tail 5
#Boolean to only write the server name once if at all.
$serverNameWritten = $false
@JFFail
JFFail / gist:7782e19a35169e4e925c
Last active Aug 29, 2015
Script to parse a text file, extract IPs, and print unique values.
View gist:7782e19a35169e4e925c
#!/usr/bin/env perl
use strict;
use warnings;
#Array to hold the results.
my %uniqueIPs;
my $index_of;
my $sub;
#Open the file.
View nameLength.sh
#!/bin/bash
letters=`echo $HOSTNAME | wc -m | tr -d ' '`
if [[ $letters -gt 15 ]]; then
echo "Your name is too long at $letters."
else
echo "Domain join can continue."
fi
@JFFail
JFFail / wwe.sh
Last active Aug 29, 2015
Shell Script for Reddit Daily Programmer - #198 Easy
View wwe.sh
#!/usr/local/bin/zsh
#Get the left word.
echo -n "Enter the left word: "
read leftWord
echo -n "Enter the right word: "
read rightWord
#Get the length of each.
llen=${#leftWord}
@JFFail
JFFail / parse-numbers.ps1
Last active Aug 29, 2015
Solution To Reddit Daily Programmer 199 - Bank Number Banners
View parse-numbers.ps1
<#
# Challenge is here:
# http://www.reddit.com/r/dailyprogrammer/comments/2tr6yn/2015126_challenge_199_bank_number_banners_pt_1/
#>
#Function to loop through each of the supplied inputs.
function ParseNums
{
param([string] $passedNum)
@JFFail
JFFail / deparse-numbers.ps1
Created Jan 30, 2015
Solution To Reddit Daily Programmer 199 - Bank Number Banners Part 2
View deparse-numbers.ps1
<#
# Reddit Daily Programmer 199 Part 2
# http://www.reddit.com/r/dailyprogrammer/comments/2u0fyx/2015126_challenge_199_bank_number_banners_pt_2/
#>
#Create the strings for the inputs.
$inputTop = " _ _ _ _ _ _ _ "
$inputMid = "|_| |_| | | |_| |_ | | | |_ "
$inputBot = " | _| |_| |_| |_| | | | _|"
@JFFail
JFFail / count_days.sh
Last active Aug 29, 2015
Solution to Reddit Daily Programmer 201
View count_days.sh
#!/usr/pkg/bin/zsh
dateMath() {
todayMonth=$(date "+%m/%d/%y" | awk -F\/ '{print $1}' | sed "s/^0//")
todayDay=$(date "+%m/%d/%y" | awk -F\/ '{print $2}' | sed "s/^0//")
todayYear=$(date "+%m/%d/%y" | awk -F\/ '{print $3}' | sed "s/^0//")
today="$todayMonth/$todayDay/$todayYear"
current=$(date -d $today +%s)
submitted=$(date -d $1 +%s)
diffDays=$((($submitted - $current) / 86400))
echo "You must wait $diffDays days from $today to $1"
@JFFail
JFFail / recursive_sum.rb
Created Feb 21, 2015
Simple example for myself of a recursive function to compute the sum of a list.
View recursive_sum.rb
#!/usr/bin/ruby
def sums(list)
if list.length > 1
return list.pop + sums(list)
else
return list.pop
end
end
#Make a list.
@JFFail
JFFail / parse-lines.ps1
Created Mar 3, 2015
Solution to Reddit Daily Programmer 204
View parse-lines.ps1
<# Reddit Daily Programmer
# http://www.reddit.com/r/dailyprogrammer/comments/2xoxum/20150302_challenge_204_easy_remembering_your_lines/
#>
function MoveBack
{
param
(
$text,
$location
@JFFail
JFFail / generate-dna.ps1
Created Mar 23, 2015
Solution To Reddit Daily Programmer #207 - Generating DNA Sequences
View generate-dna.ps1
<#
DNA Sequence - Daily Programmer #207
http://www.reddit.com/r/dailyprogrammer/comments/2zyipu/20150323_challenge_207_easy_bioinformatics_1_dna/
#>
#Main input.
$inputSequence = "A A T G C C T A T G G C"
#Hash defining the pairs.
$pairs = @{'A'='T';'T'='A';'G'='C';'C'='G'}
You can’t perform that action at this time.