Commit 317d9f97 authored by nilsl's avatar nilsl

Merge branch 'master' of gitlab.ethz.ch:thealternative/courses

parents 03ca189c 7288ff34
# LaTeX traces
*.log
*.toc
*.aux
*.out
*-blx.bib
*run.xml
*.fdb_latexmk
*.fls
*.synctex.gz
*.snm
*.nav
# Bibtex traces
*.bak
*.blg
*.bbl
# PythonTeX traces and binaries
pythontex-*/
*.pytxcode
# Gedit
*~
\documentclass[aspectratio=169]{beamer} \documentclass[aspectratio=169]{beamer}
\usepackage[T1]{fontenc} %pipes don't display properly without this \usepackage[T1]{fontenc} % the pipe character doesn't display properly without this
\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
\usepackage{listings} \usepackage{listings}
\usepackage{color} \usepackage{color}
\usepackage{datapie} \usepackage{datapie}
\usepackage{minted} % COMPILE WITH `pdflatex -shell-escape`!
\usepackage{multicol} \usepackage{multicol}
\usepackage{upgreek} \usepackage{upgreek}
\usepackage{siunitx} %pretty measurement unit rendering \usepackage{siunitx} % pretty measurement unit rendering
\usepackage{hyperref} %enable hyperlink for urls \usepackage{hyperref} % enable hyperlink for URLs
\usepackage{lmodern} \usepackage{lmodern}
\usepackage{setspace} \usepackage{setspace}
\usepackage[os=win]{menukeys} % by default keys are given for MacOS
\usefonttheme[onlymath]{serif} \usefonttheme[onlymath]{serif}
\setcounter{MaxMatrixCols}{20} \setcounter{MaxMatrixCols}{20}
...@@ -26,9 +28,9 @@ ...@@ -26,9 +28,9 @@
%Define generic colors %Define generic colors
\definecolor{slg}{gray}{0.25} \definecolor{slg}{gray}{0.25}
\definecolor{lg}{gray}{0.55} \definecolor{lg}{gray}{0.53}
\definecolor{vlg}{gray}{0.73} \definecolor{vlg}{gray}{0.73}
\definecolor{tlg}{gray}{0.9} \definecolor{tlg}{gray}{0.91}
%Define data colors %Define data colors
\definecolor{mygreen}{rgb}{0,0.6,0} \definecolor{mygreen}{rgb}{0,0.6,0}
......
#!/usr/bin/env bash #!/usr/bin/env bash
pdflatex slides.tex pdflatex -shell-escape slides.tex
bibtex slides bibtex slides
pdflatex slides.tex pdflatex -shell-escape slides.tex
pdflatex slides.tex pdflatex -shell-escape slides.tex
Name,percent Name,percent
Unix,70.5 Unix,71.4
Windows,29.5 Windows,28.6
Name,percent Name,percent
Apache,44.0 Apache,40.5
Nginx,30.7 Nginx,31.7
Cloudflare Server,11.2 Cloudflare Server,13.2
Microsoft-IIS,8.2 Microsoft-IIS,7.8
other,5.9 other,5.8
No preview for this file type
\input{header} \input{../.style/header}
\title{Free and Open Source Software} \title{Free and Open Source Software}
\author{Horea Christian} \author{Horea Christian}
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
\textcolor{ldorange}{$\sim$1970-1980:} \textcolor{ldorange}{$\sim$1970-1980:}
\begin{itemize} \begin{itemize}
\item Increasingly easy to withold control (e.g. binary-only distribution) \item Increasingly easy to withold control (e.g. binary-only distribution)
\item United States vs. IBM (1969): “Bundled Software is anticompetitive” \item United States vs. IBM (1969, dropped 1982): “Bundled Software is anticompetitive”
\item Computer Software Copyright Act (1980): “Software is patentable” \item Computer Software Copyright Act (1980): “Software is patentable”
\end{itemize} \end{itemize}
\end{frame} \end{frame}
...@@ -193,6 +193,11 @@ ...@@ -193,6 +193,11 @@
% Proprietary Software is Often Malware https://www.gnu.org/proprietary/ % Proprietary Software is Often Malware https://www.gnu.org/proprietary/
\end{frame} \end{frame}
\begin{frame}{Sustainability} \begin{frame}{Sustainability}
\begin{center}
“the quality of being able to continue over a period of time“
\end{center}
The Software: The Software:
\begin{itemize} \begin{itemize}
\item depends on no single entity for its continuity. \item depends on no single entity for its continuity.
...@@ -335,7 +340,7 @@ ...@@ -335,7 +340,7 @@
\vspace{-0.75em} \vspace{-0.75em}
\centering\tiny \centering\tiny
\DTLpiechart{radius=0.235\textheight,variable=\quantity,innerlabel={\DTLpiepercent\%},outerlabel=\name,cutaway={1-2}}{server}{\name=Name,\quantity=percent} \DTLpiechart{radius=0.235\textheight,variable=\quantity,innerlabel={\DTLpiepercent\%},outerlabel=\name,cutaway={1-2}}{server}{\name=Name,\quantity=percent}
\caption{Web Server Market Share 2019-10-04 via \href{http://w3techs.com/technologies/overview/web_server/all}{w3techs}} \caption{Web Server Market Share 2020-02-26 via \href{http://w3techs.com/technologies/overview/web_server/all}{w3techs}}
\end{figure} \end{figure}
\column{0.5\linewidth} \column{0.5\linewidth}
\begin{figure}[htbp] \begin{figure}[htbp]
...@@ -344,7 +349,7 @@ ...@@ -344,7 +349,7 @@
\DTLsetpiesegmentcolor{1}{green!40} \DTLsetpiesegmentcolor{1}{green!40}
\DTLsetpiesegmentcolor{2}{red!40} \DTLsetpiesegmentcolor{2}{red!40}
\DTLpiechart{radius=0.265\textheight,variable=\quantity,innerlabel={\DTLpiepercent\%},outerlabel=\name,cutaway={2}}{os}{\name=Name,\quantity=percent} \DTLpiechart{radius=0.265\textheight,variable=\quantity,innerlabel={\DTLpiepercent\%},outerlabel=\name,cutaway={2}}{os}{\name=Name,\quantity=percent}
\caption{Website OS Market Share 2019-10-04 via \href{http://w3techs.com/technologies/overview/operating_system/all}{w3techs}} \caption{Website OS Market Share 2020-02-26 via \href{http://w3techs.com/technologies/overview/operating_system/all}{w3techs}}
\end{figure} \end{figure}
\end{columns} \end{columns}
\end{frame} \end{frame}
...@@ -385,7 +390,7 @@ ...@@ -385,7 +390,7 @@
\caption{\copyright Red Hat, Inc.} \caption{\copyright Red Hat, Inc.}
\end{figure} \end{figure}
\begin{itemize} \begin{itemize}
\item Founded 1993 \item Founded 1993, subsidiary of IBM since 2019
\item 2015--2018 stock price $\mathrm{\upbeta_{RHT}=1.16}$ (e.g. $\mathrm{\upbeta_{MSFT}=1.22}$) \item 2015--2018 stock price $\mathrm{\upbeta_{RHT}=1.16}$ (e.g. $\mathrm{\upbeta_{MSFT}=1.22}$)
\item Very diverse open source products, e.g. OpenStack, RHEL, CloudForms \item Very diverse open source products, e.g. OpenStack, RHEL, CloudForms
\end{itemize} \end{itemize}
...@@ -431,7 +436,7 @@ ...@@ -431,7 +436,7 @@
\item Come to the next “Linux Days” events: \item Come to the next “Linux Days” events:
\textcolor{lg}{\url{http://thealternative.ch/}} \textcolor{lg}{\url{http://thealternative.ch/}}
\item Join the next “Stammtisch”:\\ \item Join the next “Stammtisch”:\\
\textcolor{lg}{18:00 Thursday, March 12 - Learning Spaces on the E Floor of ETH Building CHN Universitätestrasse 16} \textcolor{lg}{18:00 Thursday, March 5 - Katholische Hochschulgemeinde Zürich AKI, 2nd floor, Hirschengraben 86, 8001}
\item Give us feedback!\\ \item Give us feedback!\\
\textcolor{lg}{\url{https://feedback.thealternative.ch/}} \textcolor{lg}{\url{https://feedback.thealternative.ch/}}
\end{itemize} \end{itemize}
......
...@@ -25,6 +25,8 @@ git clone https://gitlab.ethz.ch/thealternative/courses.git ...@@ -25,6 +25,8 @@ git clone https://gitlab.ethz.ch/thealternative/courses.git
You can find the course materials in the various subdirectories of this repository. You can find the course materials in the various subdirectories of this repository.
You need `git-lfs` installed for the larger files to download as expected.
# For TheAlternative Members # For TheAlternative Members
This repository is kept up to date by TheAlternative members. If you teach a course, please add your slides and supplementary material, such as exercise sheets, to this repo. Do not upload any private files, as this repository is publicly visible. This repository is kept up to date by TheAlternative members. If you teach a course, please add your slides and supplementary material, such as exercise sheets, to this repo. Do not upload any private files, as this repository is publicly visible.
#!/bin/bash
printf "Building Main Presentation... "
pandoc -t beamer --template template.tex --listings pres.md -o pres.pdf --pdf-engine pdflatex
echo "Done"
int
main(int argc, char **argv) {
int arr[10];
arr[11] = 1;
return 0;
}
#include<pthread.h>
pthread_mutex_t lock1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t lock2 = PTHREAD_MUTEX_INITIALIZER;
void *
thread1(void *arg __attribute__((unused))) {
pthread_mutex_lock(&lock1);
pthread_mutex_lock(&lock2); //Lock-Order-Inversion between here...
pthread_mutex_unlock(&lock2);
pthread_mutex_unlock(&lock1);
return NULL;
}
void *
thread2(void *arg __attribute__((unused))) {
pthread_mutex_lock(&lock2);
pthread_mutex_lock(&lock1); // ... and here!
pthread_mutex_unlock(&lock1);
pthread_mutex_unlock(&lock2);
return NULL;
}
int
main(int argc, char **argv) {
pthread_t t1, t2;
pthread_create(&t1, NULL, thread1, NULL);
pthread_create(&t2, NULL, thread2, NULL);
pthread_join(t1, NULL);
pthread_join(t2, NULL);
return 0;
}
#include<stdlib.h>
int
main(int argc, char **argv) {
int *p;
p = malloc(sizeof(int));
return 0;
}
#include<pthread.h>
volatile int inc;
void *
thread(void *arg __attribute__((unused))) {
for (int i = 0; i < 65536; i++)
inc++;
return NULL;
}
int
main(int argc, char **argv) {
pthread_t t1, t2;
pthread_create(&t1, NULL, thread, NULL);
pthread_create(&t2, NULL, thread, NULL);
pthread_join(t1, NULL);
pthread_join(t2, NULL);
return 0;
}
#include<stdlib.h>
int
main(int argc, char **argv) {
int *ip;
ip = malloc(sizeof(int));
free(ip);
*ip = 3;
return 0;
}
int
main(int argc, char **argv) {
int i = 32;
int j = 0xCAFFEE;
j = j << i;
return 0;
}
#include<stdio.h>
int
main(int argc, char **argv) {
int i;
if (i)
printf("Hui\n");
else
printf("Pfui\n");
return 0;
}
#include<stdio.h>
#include<stdbool.h>
#include<tgmath.h>
bool
is_prime(int number) {
int max = ((int) sqrt((double) number)) + 1;
for (int i = 2; i < max; i++)
if (!(number % i))
return false;
return true;
}
int
main(int argc, char** argv) {
int number;
scanf("%d", &number);
if (is_prime(number))
printf("%d: prime\n", number);
else
printf("%d: not prime\n", number);
return 0;
}
#include<stdio.h>
int
main(int argc, char **argv) {
FILE *f = fopen("/tmp/test", "w+");
fprintf(f, "Hello\n");
fclose(f);
printf("Done!\n");
return 0;
}
#include<stdio.h>
int
main(int argc, char **argv) {
printf("Hello World!");
return 0;
}
This diff is collapsed.
\documentclass[aspectratio=169,12pt]{beamer}
\usepackage{lmodern}
\usepackage[T1]{fontenc} %pipes don't display properly without this
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{color}
\usepackage{datapie}
\usepackage{multicol}
\usepackage{siunitx} %pretty measurement unit rendering
\usepackage{hyperref} %enable hyperlink for urls
\usepackage{caption} % needed to tweak caption size
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{graphicx}
\newcommand{\passthrough}[1]{#1}
\usefonttheme[onlymath]{serif}
\setcounter{MaxMatrixCols}{20}
\DeclareSIUnit\pixel{px}
\usecolortheme[RGB={37,68,113}]{structure}
\usetheme{Dresden}
\newenvironment{figurehere}
{\def\@captype{figure}}
{}
\makeatother
%commands to exclude sections from miniframes
\makeatletter
\let\beamer@writeslidentry@miniframeson=\beamer@writeslidentry
\def\beamer@writeslidentry@miniframesoff{%
\expandafter\beamer@ifempty\expandafter{\beamer@framestartpage}{}% does not happen normally
{%else
% removed \addtocontents commands
\clearpage\beamer@notesactions%
}
}
\newcommand*{\miniframeson}{\let\beamer@writeslidentry=\beamer@writeslidentry@miniframeson}
\newcommand*{\miniframesoff}{\let\beamer@writeslidentry=\beamer@writeslidentry@miniframesoff}
\beamer@compresstrue
\makeatother
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
%various gray colors
\definecolor{slg}{gray}{0.25}
\definecolor{lg}{gray}{0.55}
\definecolor{vlg}{gray}{0.73}
\definecolor{tlg}{gray}{0.9}
%TheAlt colors
\definecolor{ldorange}{HTML}{F18A20}
\colorlet{ldbright}{ldorange!70!white} % tinted version of orange, used in miniframes
\definecolor{ldblue}{HTML}{254471}
%%Theme colors
%\definecolor{thgreen}{HTML}{A1A92C}
%\definecolor{thmauve}{HTML}{97284D}
%Theme colors
\definecolor{thgreen}{HTML}{539727}
\definecolor{thmauve}{HTML}{572272}
%reduce caption font size:
\captionsetup{font={scriptsize,color=lg}}
%do not prepend numbering/lettering to figures/subfigures
\captionsetup{labelformat=empty} %do not prepend letters to figure captions
%Apply TheAlt colors to theme
% section titles in top navigation bar
\setbeamercolor{section in head/foot}{parent=palette tertiary,fg=ldorange}
\setbeamertemplate{section in head/foot shaded}{\color{ldbright}\usebeamertemplate{section in head/foot}}
% miniframes (little navigation circles)
\setbeamercolor*{mini frame}{fg=ldorange,bg=ldbright}
\setbeamertemplate{mini frame in other section}[default][0]
\setbeamertemplate{mini frame in other subsection}[default][0]
% others
\setbeamercolor{author in head/foot}{fg=white}
\setbeamercolor{subsection in head/foot}{fg=white}
\setbeamercolor{caption name}{fg=vlg}
\setbeamercolor{caption}{fg=vlg}
\setbeamercolor{frametitle}{fg=ldblue}
\setbeamertemplate{caption}{\raggedright\insertcaption\par}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{bibliography item}[text]
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\lstdefinestyle{custombash}{
belowcaptionskip=1\baselineskip,
captionpos=,
breaklines=true,
frame=L,
xleftmargin=\parindent,
language=bash,
morestring=[b]',
morekeywords=[2]{sudo,zypper,notify-send,feh,youtube-dl,sort,tee,head,tail,shuf,mpv,find,convert,xrandr,curl,wget,grep,xdotool,rm,cp,mv,touch,bash,chmod,mkdir,rsync,mplayer,mpv,xdotool,jshon},
showstringspaces=false,
basicstyle=\scriptsize\ttfamily,
rulecolor=\color{tlg},
backgroundcolor=\color{tlg},
fillcolor=\color{tlg},
rulesepcolor=\color{tlg},
commentstyle=\itshape\color{thmauve!60!black},
keywordstyle=\bfseries\color{thgreen},
identifierstyle=\color{ldblue},
stringstyle=\color{thmauve}
}
\lstset{
style=custombash,
caption={Descriptive Caption Text},
label=DescriptiveLabel
}
$if(title)$
\title{$title$}
$endif$
$if(subtitle)$
\subtitle{$subtitle$}
$endif$
$if(author)$
\author{$for(author)$$author$$sep$ \and $endfor$}
$endif$
\institute{\includegraphics[width=0.35\textwidth]{img/logo_blue.pdf}}
\date{$date$}
\renewcommand{\emph}[1]{\textcolor{ldorange}{#1}}
\let\oldtextbf\textbf
\renewcommand{\textbf}[1]{\textcolor{ldorange}{\oldtextbf{#1}}}
\newcommand{\soft}[1]{\textcolor{lg}{#1}}
\newcommand{\textt}[1]{\textcolor{blue}{\texttt{#1}}}
\newcommand{\bigtext}[1]{\centering\Huge \textbf{\textcolor{ldorange}{#1}}\normalsize}
%shortcut to insert small logo in footline
\def\logo{%
\resizebox{!}{3ex}{\includegraphics{img/logo_white.pdf}}
}
% Define a custom footline that includes our logo
\setbeamertemplate{footline}
{%
\begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}
\usebeamerfont{title in head/foot}%
\insertshorttitle\hfill\insertframenumber
\end{beamercolorbox}
\begin{beamercolorbox}[wd=\paperwidth,ht=3.5ex,dp=1.625ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{author in head/foot}
\usebeamerfont{author in head/foot}
\raisebox{0.5ex}{\insertshortauthor}\hfill\raisebox{-0.5ex}{\logo}
\end{beamercolorbox}
}
\begin{document}
$if(title)$
\frame{\titlepage}
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
\begin{frame}
\tableofcontents[hideallsubsections]
\end{frame}
$endif$
$body$