From 9cae2c9499391d074bf4122d37488da254d67573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 4 Mar 2017 17:05:55 +0100 Subject: InstallFest 2017 3 problemy pri praci na 3 pocitacich --- installfest2017/face_cry.svg | 1 + installfest2017/face_happy.svg | 1 + installfest2017/face_sad.svg | 1 + installfest2017/git.eps | Bin 0 -> 284506 bytes installfest2017/makefile | 10 + installfest2017/pres.tex | 303 +++++ installfest2017/scheme.svg | 1170 ++++++++++++++++++++ installfest2017/scheme/Gorilla-server.svg | 90 ++ installfest2017/scheme/Laptop_font_awesome.svg | 59 + .../desktop-computer-with-screen-vector-icon.eps | Bin 0 -> 655462 bytes installfest2017/scheme/smartphone-call.svg | 43 + installfest2017/scheme/turris_omnia.png | Bin 0 -> 32458 bytes installfest2017/syncthing.png | Bin 0 -> 113879 bytes 13 files changed, 1678 insertions(+) create mode 100644 installfest2017/face_cry.svg create mode 100644 installfest2017/face_happy.svg create mode 100644 installfest2017/face_sad.svg create mode 100644 installfest2017/git.eps create mode 100644 installfest2017/makefile create mode 100644 installfest2017/pres.tex create mode 100644 installfest2017/scheme.svg create mode 100644 installfest2017/scheme/Gorilla-server.svg create mode 100644 installfest2017/scheme/Laptop_font_awesome.svg create mode 100644 installfest2017/scheme/desktop-computer-with-screen-vector-icon.eps create mode 100644 installfest2017/scheme/smartphone-call.svg create mode 100644 installfest2017/scheme/turris_omnia.png create mode 100644 installfest2017/syncthing.png diff --git a/installfest2017/face_cry.svg b/installfest2017/face_cry.svg new file mode 100644 index 0000000..9e8837f --- /dev/null +++ b/installfest2017/face_cry.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/installfest2017/face_happy.svg b/installfest2017/face_happy.svg new file mode 100644 index 0000000..6bc7f73 --- /dev/null +++ b/installfest2017/face_happy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/installfest2017/face_sad.svg b/installfest2017/face_sad.svg new file mode 100644 index 0000000..8c4a4c1 --- /dev/null +++ b/installfest2017/face_sad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/installfest2017/git.eps b/installfest2017/git.eps new file mode 100644 index 0000000..47500ce Binary files /dev/null and b/installfest2017/git.eps differ diff --git a/installfest2017/makefile b/installfest2017/makefile new file mode 100644 index 0000000..9ab8f60 --- /dev/null +++ b/installfest2017/makefile @@ -0,0 +1,10 @@ +FILE=pres + +$(FILE).pdf: $(FILE).tex $(patsubst %.svg,%.pdf,$(wildcard *.svg)) + pdflatex -shell-escape $< + +%.pdf: %.svg + inkscape -D -z --file=$< --export-pdf=$@ --export-latex + +clean: + ls | grep -v -E "($(FILE).tex|makefile|scheme|svg|png|eps)$$" | xargs rm -rf diff --git a/installfest2017/pres.tex b/installfest2017/pres.tex new file mode 100644 index 0000000..2138f82 --- /dev/null +++ b/installfest2017/pres.tex @@ -0,0 +1,303 @@ +\documentclass{beamer} +\usetheme{metropolis} +\usepackage{lmodern} +\usepackage[czech]{babel} +\usepackage[utf8x]{inputenc} +%\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{graphicx} +\usepackage{wrapfig} +\usepackage{color} +\usepackage{mathtools} +\usepackage{hyperref} +\usepackage{epstopdf} +\usepackage{svg} +\usepackage{amsmath} +\usepackage{minted} +\hypersetup{ + colorlinks, + citecolor=black, + filecolor=black, + linkcolor=black, + urlcolor=black +} +\usepackage{pdflscape} + +\title{3 problémy při práci na 3 počítačích} +\author{Karel Kočí} + +\begin{document} + +\frame{\titlepage} + +\begin{frame} + \begin{block}{\huge Napiš si skript!} + Přednášené skripty a více naleznete na: + \url{https://github.com/Cynerd/myconfigs} + \end{block} +\end{frame} + +\begin{frame} + \frametitle{3 problémy} + \begin{itemize} + \item Synchronizace souborů + \item Synchronizace a správa konfigurací + \item Správa systému + \end{itemize} +\end{frame} + +\begin{frame} + \frametitle{Synchronizace souborů} + \def\svgwidth{1cm} + \input{face_sad.pdf_tex} + \begin{itemize} + \item Dropbox + \item Mega + \item Google drive + \item \ldots + \end{itemize} + + \def\svgwidth{1cm} + \input{face_cry.pdf_tex} + \begin{itemize} + \item Owncloud/Nextcloud + \end{itemize} + + \def\svgwidth{1cm} + \input{face_happy.pdf_tex} + \begin{itemize} + \item Syncthing + \end{itemize} +\end{frame} + +\begin{frame} + \frametitle{``Easy to use'' říkají} + \includegraphics[width=11cm]{syncthing.png} +\end{frame} + +\begin{frame} + \frametitle{Matematický problém} + Přidání zařízení mezi N synchronizujících M složek. + + \begin{itemize} + \item Nastav nové zařízení + \item $N$-krát přidej zařízení + \item $N$-krát spáruj s novým zařízením + \item $N \times M$ přidej k synchronizovaným složkám + \item $M$-krát přidej složku na novém zařízení + \end{itemize} + + \vspace{0.4cm} + \[ + 1+\left(M+2\right)N+M + \] +\end{frame} + +\begin{frame} + \frametitle{Moje zařízení} + \def\svgwidth{27cm} + \input{scheme.pdf_tex} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Syncthing konfigurace hodně zjednodušeně} + \small + \begin{minted}{xml} + + + + + + + + + + +
dynamic
+
+ +
tcp://cynerd.cz
+
+
+\end{minted} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Napiš si skript, vstupní data} + \begin{minted}{bash} +# Syncthing PC id +ID="0000000-0000000-0000000-0000000-.." +# Name of machine +NAME="cynerd-pc" +# Address to machine, can be tcp://address.com or dynamic +ADDRESS="dynamic" + +# Directoris to be synchronized +# Format is ID:PATH +DIRS="Sync:/home/user/Sync +Sync2:/home/user/SyncIt" + +# REST api key +APIKEY="bT6dCxEds9JPwiXMXavGNsXsz7ZFpSC5" +\end{minted} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Napiš si skript, generuj zařízení do XML} + \begin{minted}{bash} +# ... +for h in syncthing/*; do + +. "$h" # Source host +# Set to configuration +echo "" >>$TMPCNF +echo "
$ADDRESS
" >>$TMPCNF +echo "
" >>$TMPCNF +# Parse DIRS of this host +eval `echo "$DIRS" | sed -ne \ +'s/^\([^:]*\):.*$/ST_DIR_HOSTS_\1="$ST_DIR_HOSTS_\1 $ID"/p'` + +done +# ... +\end{minted} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Napiš si skript, generuj složky do XML} + \begin{minted}{bash} +# ... +. syncthing/"$HOST" +while read -r d; do +NM="$(echo "$d" | sed 's/:.*$//')" # Directory name +PTH="$(echo "$d" | sed 's/^[^:]*://')" # Get target path +# Write folder init +echo "" >>$TMPCNF +# Specify every all devices +for dev in eval `echo \$ST_DIR_HOSTS_$NM`; do + echo "" >>$TMPCNF +done +# ... +done <<<"$DIRS" +# ... +\end{minted} +\end{frame} + +\begin{frame} + \frametitle{Moje řešení} + + \begin{itemize} + \item Nastav nové zařízení + \item Přidej do sdílené konfigurace + \item N-krát deploy konfigurace + \end{itemize} + + \vspace{0.4cm} + \[ + 2+N < 1+\left(M+2\right)N+M + \] +\end{frame} + +\begin{frame} + \frametitle{Synchronizace konfigurace} + \includegraphics[width=3cm]{git.eps} + + \vspace{1cm} + \begin{block}{\$HOME dot soubory} + 3 zařízení 3 různé požadavky + \begin{itemize} + \item Laptop, OpenRC, Bumblebee, 2 disky + \item Laptop, OpenRC + \item Desktop, Systemd + \end{itemize} + \end{block} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Skriptujeme jednoduše} + \begin{minted}{bash} +# install.sh +cd `dirname $0` +rsync -rlpt bashrc ~/.bashrc +rsync -rlpt profile ~/.profile + + +# get.sh +cd `dirname $0` +rsync -rlpt ~/.bashrc bashrc +rsync -rlpt ~/.profile profile +\end{minted} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Skriptujeme s vimdiff} + \begin{minted}{bash} +cd `dirname $0` +checkdiff() { + for f in `find "$1" -type f`; do + if ! cmp "$1" "$f" >/dev/null; then + F="${f#$1}" + vimdiff "$1/$F" "$2/$F" + fi + done +} +inst() { + [ -e "$2" ] && checkdiff "$1" "$2" \ + || rsync -rlpt "$1" "$2" +} +inst bashrc ~/.bashrc +\end{minted} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Skriptujeme skupinky} + \begin{minted}{bash} +# ... + +read -p "Install bashrc? (Y/n) " +if [[ $REPLY =~ ^[Yy]?$ ]]; then + inst bashrc ~/.bashrc + inst profile ~/.profile +fi + +read -p "Install VIM scripts? (Y/n) " +if [[ $REPLY =~ ^[Yy]?$ ]]; then + inst vimrc ~/.vimrc + inst vim ~/.vim +fi + +\end{minted} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Balíčky jako konfigurace} + Pro Archlinux: + \begin{minted}{bash} +sudo pacman -D --asdeps pkg +sudo pacman -D --asexplicit pkg +\end{minted} + + \begin{minted}{bash} +m4 archlinux.pkgs | sort | uniq > /tmp/file1 +pacaur -Qqe | sort > /tmp/file2 +diff --supppress-common-lines -ay /tmp/file1 /tmp/file2 +\end{minted} +\end{frame} + +\begin{frame} + \frametitle{Závěrem} + \begin{itemize} + \item Jeden git repositář s konfigurací + \item Skript pro přesun změn v konfiguračních souborech z a do repositáře + \item Skript porotnání explicitně nainstalovaných balíčků + \item Skript pro generování Syncthing konfigurace + \end{itemize} +\end{frame} + +\begin{frame} + \begin{block}{\large Děkuji za pozornost} + \end{block} + \url{https://github.com/Cynerd/myconfigs} + % TODO +\end{frame} + +\end{document} diff --git a/installfest2017/scheme.svg b/installfest2017/scheme.svg new file mode 100644 index 0000000..d0ab1c8 --- /dev/null +++ b/installfest2017/scheme.svg @@ -0,0 +1,1170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/installfest2017/scheme/Gorilla-server.svg b/installfest2017/scheme/Gorilla-server.svg new file mode 100644 index 0000000..7fab2d9 --- /dev/null +++ b/installfest2017/scheme/Gorilla-server.svg @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/installfest2017/scheme/Laptop_font_awesome.svg b/installfest2017/scheme/Laptop_font_awesome.svg new file mode 100644 index 0000000..edd1dea --- /dev/null +++ b/installfest2017/scheme/Laptop_font_awesome.svg @@ -0,0 +1,59 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/installfest2017/scheme/desktop-computer-with-screen-vector-icon.eps b/installfest2017/scheme/desktop-computer-with-screen-vector-icon.eps new file mode 100644 index 0000000..7b7d251 Binary files /dev/null and b/installfest2017/scheme/desktop-computer-with-screen-vector-icon.eps differ diff --git a/installfest2017/scheme/smartphone-call.svg b/installfest2017/scheme/smartphone-call.svg new file mode 100644 index 0000000..a9b0186 --- /dev/null +++ b/installfest2017/scheme/smartphone-call.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/installfest2017/scheme/turris_omnia.png b/installfest2017/scheme/turris_omnia.png new file mode 100644 index 0000000..d89d93c Binary files /dev/null and b/installfest2017/scheme/turris_omnia.png differ diff --git a/installfest2017/syncthing.png b/installfest2017/syncthing.png new file mode 100644 index 0000000..d644c4a Binary files /dev/null and b/installfest2017/syncthing.png differ -- cgit v1.2.3