Skip to content

Instantly share code, notes, and snippets.

View tech-zombie's full-sized avatar

Ade Roberts tech-zombie

View GitHub Profile
$allGames = gc .\input.txt
$score = 0
#Rock = A X 1
#Paper = B Y 2
#scissors = C Z 3
#(0 if you lost, 3 if the round was a draw, and 6 if you won).
forEach ($game in $allGames)
{
switch ($game) {
"A X" {$score += 3 ; $score += 1}#draw RR
$calList = gc input.txt
$calorieTotal = 0
$elfNumber = 0
$elves = foreach ($package in $callist)
{
if ($package -eq ''){
#record calories and zero total
[PSCustomObject]@{
Elf = $elfNumber
@tech-zombie
tech-zombie / _part1.ps1
Created December 6, 2020 22:37
AdventOfCode2020 day6
$list = gc .\day6input.txt -Delimiter "`n`r"
$answer = 0
foreach ($group in $list)
{
$group = (($group -replace "`n","")-replace " ","")-replace "`r",""
$answer = $answer + (($group.ToCharArray() | sort -unique).count)
}
$answer
@tech-zombie
tech-zombie / _part1.ps1
Last active December 6, 2020 22:31
AdventOfCodeDay5
#####puzzle can be found here: https://adventofcode.com/2020/day/5
$list = gc .\day5Input.txt
$highest =0
foreach ($ticket in $list)
{
$rowCode = $ticket.Substring(0,7).ToCharArray()
$columnCode = $ticket.Substring(7,3).ToCharArray()
$rowLowerbound = 0
@tech-zombie
tech-zombie / _part1.ps1
Last active December 4, 2020 20:54
Advent of code day3 2020 POSH
#puzzle can be found at https://adventofcode.com/2020/day/3
$i = gc .\input.txt
$position = 1
$results = $null
$horizontalMovement = 3
foreach($line in $i)
################PART 1################
(((Get-Content .\input.txt -raw) -replace " ",",") -replace "-",",") -replace ":","" > input.csv
$header ="min","max","char","password"
$list = import-csv .\input.csv -header $header
$total = 0
foreach ($line in $list)
{
#https://adventofcode.com/2020/day/1
################part 1################
$list = Get-Content .\list.txt
foreach ($item in $list)
{
foreach ($item1 in $list)
{
$total = [int]$item + [int]$item1
if ($total -eq 2020)
@tech-zombie
tech-zombie / executePoSHfromPage.aspx.cs
Last active November 13, 2020 23:24
executePoSHfromPage.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Management.Automation;
using System.Text;
namespace PowerShellExecution
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="PowerShellExecution.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
@tech-zombie
tech-zombie / set-dnsServer.ps1
Last active January 29, 2019 11:51
Sets DNS server based on octet in AWS
<##>
param (
[int]$WhichOctet,
[int]$Zone1_OctetValue,
[int]$Zone2_OctetValue,
$DNSZone1_server,
$DNSZone2_server
)