Compare commits
3 commits
2c82137a71
...
0227f460bf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0227f460bf | ||
|
|
9c0cee4083 | ||
|
|
d1a39bf85d |
5 changed files with 88 additions and 24 deletions
20
interview_scripts/fizzbuzz.pl
Executable file
20
interview_scripts/fizzbuzz.pl
Executable 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
45
interview_scripts/test1.pl
Executable 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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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
8
vm_setup/vm_solus.sh
Normal 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
15
vm_setup/zsh_basic.sh
Normal 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 ~/
|
||||||
Loading…
Add table
Add a link
Reference in a new issue