ZHAW

Lisp Praktikum 1

Lisp Praktikum 1 1. First Steps a. ;; 10 * (4 + 3 + 3 + 1) - 20 = 90 * (- (* 10 (+ 4 3 3 1)) 20) 90 * 42 42 ;;evalueates to itself * pi 3.141592653589793d0 * (/4 3) 4/3 * (/ 12 3) 4 * (/ 4 3.0) 1.3333334 * (+ 0.5 1/2) 1.0 * (+ 0.5 1/4) 0.75 * (+ 1/2 1/4) 3/4 * (* 35 1.

PSPP Python

Python For Loops really comfortable with range function: for n in range(2,10): for x in range(2, n): if n% x == 0: print(n, 'equals', x, '*', n//x) break else: #Loop fell through without finding a factor print(n, 'is a prime number') Scope Rules different Scopes local inside function(method,…) global in the surrounding modul built-in pre defined names(open, len,…) function call creates a local scope search order when reading local > global > built-in

CCP1 Day7 Docker

LAB CCP1 CMP2 - Docker Task 3 install MongoDB only needed so we know the commands for our Dockerfile but the image worked only after we added wget and gnupg2, too mongodb 3.4 was not available anymore for ubuntu focal curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list apt update apt install mongodb-org create Docker File # syntax=docker/dockerfile:1 FROM ubuntu:20.

CCP1 Day7 cgroup

LAB CCP1 CMP2 - Containers Task 1 Decided to use own VM instead of ZHAWs Cloudlab. Using same Server I have been using for microk8s. Had to install Docker: tom@microk8s:~$sudo snap install docker Task 2 Check cgroups: tree /sys/fs/cgroup/pids mount -t cgroup -o cpu none /sys/fs/cgroup/cpu #can not be mounted at the same time as mount -t cgroup -o cpu,cpuacct none sys/fs/cgroup/cpu,cpuacct mount | grep gcroup cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct) #To find the cgroup to which a process belongs, run: ps -O cgroup #Or, if you know the PID for the process, run: cat /proc/PID/cgroup Install on Ubuntu #install (on Ubuntu) sudo apt install cgroup-tools hirarchy for cpu and memory #create hirarchy for cpuset subsystem mkdir /sys/fs/cgroup/cpu/red mkdir /sys/fs/cgroup/cpu/blue mkdir /sys/fs/cgroup/memory/lab1 mount -t cgroup -o cpu red /sys/fs/cgroup/cpu/red mount -t cgroup -o cpu blue /sys/fs/cgroup/cpu/blue #don't quite understand why this should be necessary.

CCP1 Day6

LAB Part 1 Verify environment ubuntu@source:~$ lsmod | grep kvm kvm_intel 180224 0 kvm 561152 1 kvm_intel irqbypass 16384 1 kvm ubuntu@source:~$ sudo virsh net-list Name State Autostart Persistent ---------------------------------------------------------- default active yes yes ubuntu@source:~$ sudo virsh net-dumpxml default <network> <name>default</name> <uuid>652aa9c9-84a8-4765-be6b-47437a87d0d6</uuid> <forward mode='nat'> <nat> <port start='1024' end='65535'/> </nat> </forward> <bridge name='virbr0' stp='on' delay='0'/> <mac address='52:54:00:05:3b:c8'/> <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.122.2' end='192.168.122.254'/> </dhcp> </ip> </network> my_vm.xml ubuntu@source:~$ more my_vm.xml <domain type='kvm'> <name>my_vm</name> <memory>512000</memory> <vcpu placement='static' current='1'>4</vcpu> <os> <type>hvm</type> <boot dev='cdrom'/> <boot dev='hd'/> <bootmenu enable='yes' timeout='10000'/> </os> <features> <acpi/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/kvm</emulator> <disk type="file" device="disk"> <driver name="qemu" type="qcow2"/> <source file="/home/ubuntu/my_vm.

CCP1 Day5

LAB Goal of this LAB is to deploy a small Todo App on microk8s. The App consists of three components: Redis DB node JS Rest API node JS based frontend All images can be found on Docker Hub. First step is a deployment on ZHAWs Could LAB. For how to run your own microk8s instance check out the end of this post. run this shellscript to fetch and run all yaml files needed: (run at your own risk)

CCP1 Day1

Content: Basic Concepts Motivation and Value Proposition Definition of Cloud Computing Examples and Swiss Perspective Considerations Better spend OPEX than CAPEX CAPEX+OPEX=TCO (Total Cost of Ownership) Definition of Cloud Computing Cloud Computing Principals On demand self service The consumer can provision computing capabilties, without requiring human interaction on service provider side. Broad Network Access Capabilities are available over the network and access through standard mechanisms that promote use by heterogeneous thin or thick client platfomrs(e.

Lisp Part Two

History Lisp Machines with Emacs Clojure Is a dialect of Lisp lisp-journey.gitlab.io Hirachical Structures JavaScript vs. Lisp [ "copy", { "todir" : "../new/dir" "fileset" : [ { "dir" : "src_dir" } ] } ] (copy (todir "../new/dir") (fileset (dir "src_dir")))i Functions cadr car cdr ’ everything after not evaluated specialities of Common Lisp Symbols can have multiple bindings (set '= 42) (symbol-function '=) (symbol-value '=) (symbol-plist '=) (= = =) Macros evaluation of arguments is not always desired

Lisp Part One

Lisp Part One Using SBCL (Steel Bank common Lisp) on Debian simple stuff * (quote (was ist den hier los)) (WAS IST DEN HIER LOS) ;;Das ist einen Liste * '(was ist den hier los) (WAS IST DEN HIER LOS) ;;Auch eine Liste * '(was ist (denn hier) los) ;;Verschachtelte Liste (WAS IST (DENN HIER) LOS) * '(die "Antwort" ist 42) (DIE "Antwort" IST 42) * '(+ 1 2 3 4 5) (+ 1 2 3 4 5) ;;Liste * (+ 1 2 3 4 5) ;;Addition 15 * (defun dbl (n) (* 2 n) DBL Usefull Stuff * (mapcar 'dbl '(1 2 3 4)) ;;applies our function to a list (2 4 6 8) (set 'ding '(auto (marke "VW") (baujahr 1981) (gewicht (894 kg)))) (AUTO (MARKE "VW") (BAUJAHR 1981) (GEWICHT (894 KG))) (mapcar 'second (rest ding)) ;;AUTO is not of type list, that's why we remove it with rest ("VW" 1981 (894 KG)) ;;gives the 2nd element of each list entry