From d1a39bf85dc0483abad50d2f5f5a01c6d66b10c6 Mon Sep 17 00:00:00 2001 From: Tracey Clark Date: Sat, 8 Jun 2024 15:49:48 -0500 Subject: [PATCH 1/3] Add simple scripts used in interviews --- interview_scripts/fizzbuzz.pl | 20 ++++++++++++++++ interview_scripts/test1.pl | 45 +++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100755 interview_scripts/fizzbuzz.pl create mode 100755 interview_scripts/test1.pl 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; + + } +} From 9c0cee40833c99b798a6def4bde3cc599b898264 Mon Sep 17 00:00:00 2001 From: Tracey Clark Date: Sat, 8 Jun 2024 15:51:37 -0500 Subject: [PATCH 2/3] Add scripts to be run in new Solus VMs --- vm_setup/vm_solus.sh | 8 ++++++++ vm_setup/zsh_basic.sh | 15 +++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 vm_setup/vm_solus.sh create mode 100644 vm_setup/zsh_basic.sh 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 From 0227f460bf99f6fc0406a02f1923cde8d23b0f6c Mon Sep 17 00:00:00 2001 From: Tracey Clark Date: Sat, 8 Jun 2024 16:03:33 -0500 Subject: [PATCH 3/3] Remove oct script that was moved to Solus tooling repo --- solus_utility/solus_goto_oct.sh | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100755 solus_utility/solus_goto_oct.sh 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