Skip to content

Instantly share code, notes, and snippets.

@0ryant
0ryant / boxgame-v1.ps1
Last active May 17, 2021 13:21
ironscripter pwsh summit / devops collective box game thingy
#region funcs
function checkSum {
param (
$upnums,
[int]$diceroll
)
$sum = ($upnums | Measure-Object -sum).Sum
for ($i=0; $i -lt $upnums.count; $i++){
for ($j=0; $j -lt $upnums.count; $j++){
if (($upnums[$i] + $upnums[$j] -eq $diceroll) -and ($i -ne $j) -or ($upnums[$i] -eq $diceroll) -or ($sum -eq $diceroll)){
@0ryant
0ryant / OpsGenieAlerts.psm1
Last active June 1, 2020 08:54
ps module to use the opsgenie alerts api
#region notes
<#
Ryan Tilcock 29-5-2020
v1 - added basic functionality for each alert api method on https://docs.opsgenie.com/docs/alert-api
#>
#endregion
@0ryant
0ryant / gist:cab2165922f4d9070f7eaaead5edf5b3
Created August 28, 2019 08:21
Mocking / Spongebob text converter
function Get-MockingText {
<#
.SYNOPSIS
This function changes a normal text string to a TeXt sTrInG LiKe tHiS
.DESCRIPTION
InTeRnEt cUlTuRe dEmAnDs a qUiCkEr aNd eAsIeR WaY Of tYpInG ThInGs lIkE ThIs. HeNcE ThIs fUnCtIoN.
.PARAMETER InputObject
@0ryant
0ryant / gist:7c6ce0ea22690b7757f8dabf81bf4267
Last active August 28, 2019 10:24
Uninstall Microsoft Teams with GPO link
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
$DebugPreference = 'continue'
Clear-Host
try
{
$user = ((Get-WmiObject -Class Win32_ComputerSystem).username).tolower()
#$user = $user -replace 'fe.',''
@0ryant
0ryant / gist:14784edf7fd645b63f61a841a7f51031
Created August 13, 2019 13:24
Java - Coding Challenge - Classes; Co-ordinates Distance Calculator
public class Point {
// Params
private int x;
private int y;
// Constructors
public Point() {
this(0,0);
}
@0ryant
0ryant / gist:25cf8679ed62491d5bbcb173a214d8cd
Created August 13, 2019 11:50
Java - Coding Challenge - Classes; Wall Area
public class Wall {
// Params
private double width;
private double height;
// Constructors
public Wall() {
}
public Wall(double width,double height){
@0ryant
0ryant / gist:ea15d36c713f444eddd36c97e0d4fea6
Created August 13, 2019 11:22
Java - Coding Challenge - Bank Account
public class BankAccount {
// Params
private String accountNumber;
private double balance;
private String customerName;
private String emailAddress;
private String phoneNumber;
// Constructors
@0ryant
0ryant / gist:91a8dc6fb32e6b36691b88b6dc2e8c39
Created August 13, 2019 08:29
Java - Coding Challenge - Classes; Person
public class Person {
private String firstName;
private String lastName;
private int age;
public String getFirstName(){
return firstName;
}
public String getLastName(){
@0ryant
0ryant / gist:ddcbf9172c43a7e98170164c8d82df0d
Created August 13, 2019 08:12
Java - Coding Challenge - Classes; Simple Calculator
public class SimpleCalculator {
private double firstNumber;
private double secondNumber;
public double getFirstNumber(){
return firstNumber;
}
public double getSecondNumber(){
return secondNumber;
@0ryant
0ryant / gist:e1219044ad766ac07244ea5a96849c34
Created August 12, 2019 14:48
Java - Coding Challenge - How many Buckets does Bob need?
public static int getBucketCount(double width, double height, double areaPerBucket, int extraBuckets) {
if ((width <= 0) || (height <= 0) || (areaPerBucket <= 0)||(extraBuckets<0)) {
return -1;
}
double wallArea = (width * height);
int bucketsNeeded = (int) ((wallArea / areaPerBucket) - extraBuckets);
if (bucketsNeeded < (wallArea/areaPerBucket)){