Compare commits

...

3 commits

Author SHA1 Message Date
Tracey Clark
0227f460bf Remove oct script that was moved to Solus tooling repo 2024-06-08 16:03:33 -05:00
Tracey Clark
9c0cee4083 Add scripts to be run in new Solus VMs 2024-06-08 15:51:37 -05:00
Tracey Clark
d1a39bf85d Add simple scripts used in interviews 2024-06-08 15:49:48 -05:00
5 changed files with 88 additions and 24 deletions

20
interview_scripts/fizzbuzz.pl Executable file
View file

@ -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";
}
}

45
interview_scripts/test1.pl Executable file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env perl
#use Modern::Perl;
use strict;
use warnings;
use List::Util qw( reduce );
my @array_in = ();
while (<STDIN>) {
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;
}
}

View file

@ -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

8
vm_setup/vm_solus.sh Normal file
View file

@ -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

15
vm_setup/zsh_basic.sh Normal file
View file

@ -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 ~/