Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • bbenyoussef/courses
  • gduarte/courses
  • mgrueninger/courses
  • thealternative/courses
4 results
Show changes
\usepackage{xcolor}
\usepackage[margin=2cm]{geometry}
%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
\definecolor{ldblue}{HTML}{254471}
%%Theme colors
%\definecolor{thgreen}{HTML}{A1A92C}
%\definecolor{thmauve}{HTML}{97284D}
%Theme colors
\definecolor{thgreen}{HTML}{539727}
\definecolor{thmauve}{HTML}{572272}
\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{
basicstyle=\ttfamily,
backgroundcolor=\color{black!10},
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
captionpos=b,
breaklines=true,
breakatwhitespace=true,
breakautoindent=true,
linewidth=\textwidth,
style=custombash
}
<div id="bashnav" class="left">
<div id="bashnav-scroll">
<div id="bashnav-wrap">
$toc$
</div>
</div>
</div>
<div id="bashguide">
<?prettify?>
$body$
</div>
#!/bin/bash
echo "Building pdf..."
pandoc -t beamer --template template.tex --listings pres.md -o pres.pdf --pdf-engine pdflatex \
&& echo "Build successful"
\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
\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
%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}
%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,
showstringspaces=false,
basicstyle=\scriptsize\ttfamily,
rulecolor=\color{tlg},
backgroundcolor=\color{tlg},
fillcolor=\color{tlg},
rulesepcolor=\color{tlg},
commentstyle=\itshape\color{purple!60!black},
keywordstyle=\bfseries\color{ldorange!80!black},
%keywordstyle=\bfseries\color{green!40!black},
identifierstyle=\color{blue},
stringstyle=\color{orange},
}
\lstset{language=Bash,style=custombash,caption={Descriptive Caption Text},label=DescriptiveLabel}
\title{Bash Workshop}
\author{Aline Abler}
\institute{\includegraphics[width=0.35\textwidth]{img/logo_blue.pdf}}
\renewcommand{\emph}[1]{\textcolor{ldorange}{#1}}
\newcommand{\soft}[1]{\textcolor{lg}{#1}}
\newcommand{\textt}[1]{\textcolor{blue}{\texttt{#1}}}
\newcommand{\bigtext}[1]{\centering\Huge \textbf{\textcolor{ldorange}{#1}}}
%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}
}
---
author:
- Tux
title: Template Presentation
---
# Overview
## Table of Contents
### What will we do today?
* Theory
* What is bash?
* The basics
* Exercises
# What is bash?
## Shells
### Bash is a not a programming language.
* It is a *shell*
* It is an interface between you and your computer
* It allows you to access the operating system’s services (i.e.
run programs)
* *It is not designed as a programming language*, but can be used
as such
# The basics
## How to bash
### Look, a bash script
# !/bin/bash
echo 'Hello World'
echo Bash is awesome
# Now some fun stuff:
sudo dnf update
notify-send 'Update complete'
feh --bg-fill 'pictures/fancy_wallpaper.jpg'
youtube-dl -o 'Video.%(ext)s' 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
### What bash can do
* Automate anything you can do from a console
* Let several separate programs work together
## Strings
### All about strings
\bigtext{Everything is a string}
### Meaning of strings
ls my file
* `ls`, `my` and `file` are single strings
* The first string becomes the command, all following become
*arguments*
<!-- -->
ls 'my file'
* Here, `my file` is just one string
### Remember!
\bigtext{Every word is a single argument unless you use quotes.}
## Commands
### All about commands
\bigtext{Everything that does something is a command}
### Example
* wrong:
[[1==3]]
* Bash's answer:
bash: [[1==3]]: command not found
* correct:
[[ 1 == 3 ]]
## Expansion
### Bash doesn’t only run commands
* *Tilde expansion*\
`~/files` becomes `/home/alex/files`
* *Variable expansion*\
`$BROWSER` becomes `Firefox`
* *Arithmetic expansion*\
`$(( 1 + 4 ))` becomes `5`
* *Command substitution*\
`$( pwd )` becomes `/home/alex/scripts`
* *Pathname expansion* (or *globbing*)\
`files/qui*` becomes `files/quicknotes files/quiz`
### Bash doesn’t only run commands
* Expansion happens before any command is run
* Double quotes (") don't prevent expansion, but single quotes (') do.
$ echo "$HOME" '$HOME'
/home/alex $HOME
* Expansion happens *before word splitting*
## How to write a bash script
### How to write a bash script
* I want a script that searches youtube and downloads the first video it finds
### Splitting it up
* Search youtube
* Download video
### Google for a program that already does what you need
* `youtube-dl` can download a video from youtube
<!-- -->
youtube-dl -o 'Video.%(ext)s' 'https://www.youtube.com/watch?v=lAIGb1lfpBw'
### Course material
* These slides, exercise sheet and bash guide: \
\soft{http://thealternative.ch}
<!-- -->
* \soft{Theme by} Christian Horea, [CC BY](https://creativecommons.org/licenses/by/4.0/)
* \soft{Original Presentation by} Aline Abler
\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
\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$
$for(include-after)$
$include-after$
$endfor$
\end{document}