diff --git a/interview_scripts/fizzbuzz.pl b/interview_scripts/fizzbuzz.pl new file mode 100755 index 0000000..68faa9c --- /dev/null +++ b/interview_scripts/fizzbuzz.pl @@ -0,0 +1,20 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +#Fizz buzz example +# For 1 .. 10 if odd print fizz, otherwise print buzz + +for my $num (1..10) { + # print "$num: "; # Debug + if ($num % 2) { + print "fizz\n"; + } + else { + print "buzz\n"; + } +} + + + diff --git a/interview_scripts/test1.pl b/interview_scripts/test1.pl new file mode 100755 index 0000000..91f18ac --- /dev/null +++ b/interview_scripts/test1.pl @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +#use Modern::Perl; +use strict; +use warnings; +use List::Util qw( reduce ); + +my @array_in = (); +while () { + chomp($_); + last if ($_ eq ''); + push(@array_in, $_); +} + +foreach (@array_in) { + printf "%s\n", $_; +} + +print "Array in is @array_in\n"; + +get_smallest_missing(@array_in); + +sub get_smallest_missing { + my (@numbers_array) = @_; + my $integer = 0; + + # If 1 is not present in the array it is the lowest integer not in the array + if ( ! grep( /1/, @numbers_array ) ) { + print "1 is not in the array, it is the lowest integer not in array\n"; + $integer = 1; + return $integer; + } + else { + + $integer = + reduce { $numbers_array[$a] <= $numbers_array[$b] ? $a : $b } + grep { $numbers_array[$_] >= 2 } + 0..$#numbers_array; + + print "Returning integer $integer\n"; + + return $integer; + + } +} diff --git a/solus_utility/solus_goto_oct.sh b/solus_utility/solus_goto_oct.sh deleted file mode 100755 index bd98175..0000000 --- a/solus_utility/solus_goto_oct.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -# Update solus infra repo and get to oct directory -# Used when emailing OC backers - -function update_repos() { - printf "[INFO] Updating the Solus package repo\n" - gotosoluspkgs - git stash - git switch main - git fetch && git pull - - printf "[INFO] Updating the Solus infrastructure-tooling repo \n" - cd ../infrastructure-tooling - git switch master - git fetch && git pull - - printf "[INFO] Switching to the oct directory\n" - cd oct - exec bash -} - -source ~/.bashrc.d/solus-monorepo-helpers.sh - -update_repos diff --git a/vm_setup/vm_solus.sh b/vm_setup/vm_solus.sh new file mode 100644 index 0000000..bbb50b8 --- /dev/null +++ b/vm_setup/vm_solus.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# Solus specific VM setup + +source ./zsh_basic.sh + +if test -d $PWD/solus-packages; then + cp /mnt/vmshare/.zshrc.d/* ~/.zshrc.d/ +fi diff --git a/vm_setup/zsh_basic.sh b/vm_setup/zsh_basic.sh new file mode 100644 index 0000000..d9cfd41 --- /dev/null +++ b/vm_setup/zsh_basic.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Set up zsh on a local VM +# This has to be run (somehow) from the local host + +mkdir ~/.zshrc.d +sudo mkdir /mnt/vmshare +sudo chown tracey:tracey /mnt/vmshare +sudo echo 'vmshare /mnt/vmshare virtiofs rw,x-systemd.automount,relatime 0 0' | sudo tee -a /etc/fstab &&\ +systemctl daemon-reload && sudo mount vmshare + +cp /mnt/vmshare/.aliases ~/ +cp /mnt/vmshare/.bashrc ~/ +cp /mnt/vmshare/.bash_profile ~/ +cp /mnt/vmshare/.zshrc ~/ +cp /mnt/vmshare/.zsh_tlc ~/ \ No newline at end of file