From 4555491b5fdb3f38c731e409c2f98b46ac675efa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 17 Oct 2017 07:59:09 +0200 Subject: Some directory movements --- 2017-installfest/face_cry.svg | 1 + 2017-installfest/face_happy.svg | 1 + 2017-installfest/face_sad.svg | 1 + 2017-installfest/git.eps | Bin 0 -> 284506 bytes 2017-installfest/makefile | 10 + 2017-installfest/pres.pdf | Bin 0 -> 344798 bytes 2017-installfest/pres.tex | 304 +++++ 2017-installfest/scheme.svg | 1170 ++++++++++++++++++++ 2017-installfest/scheme/Gorilla-server.svg | 90 ++ 2017-installfest/scheme/Laptop_font_awesome.svg | 59 + .../desktop-computer-with-screen-vector-icon.eps | Bin 0 -> 655462 bytes 2017-installfest/scheme/smartphone-call.svg | 43 + 2017-installfest/scheme/turris_omnia.png | Bin 0 -> 32458 bytes 2017-installfest/syncthing.png | Bin 0 -> 113879 bytes 14 files changed, 1679 insertions(+) create mode 100644 2017-installfest/face_cry.svg create mode 100644 2017-installfest/face_happy.svg create mode 100644 2017-installfest/face_sad.svg create mode 100644 2017-installfest/git.eps create mode 100644 2017-installfest/makefile create mode 100644 2017-installfest/pres.pdf create mode 100644 2017-installfest/pres.tex create mode 100644 2017-installfest/scheme.svg create mode 100644 2017-installfest/scheme/Gorilla-server.svg create mode 100644 2017-installfest/scheme/Laptop_font_awesome.svg create mode 100644 2017-installfest/scheme/desktop-computer-with-screen-vector-icon.eps create mode 100644 2017-installfest/scheme/smartphone-call.svg create mode 100644 2017-installfest/scheme/turris_omnia.png create mode 100644 2017-installfest/syncthing.png (limited to '2017-installfest') diff --git a/2017-installfest/face_cry.svg b/2017-installfest/face_cry.svg new file mode 100644 index 0000000..9e8837f --- /dev/null +++ b/2017-installfest/face_cry.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/2017-installfest/face_happy.svg b/2017-installfest/face_happy.svg new file mode 100644 index 0000000..6bc7f73 --- /dev/null +++ b/2017-installfest/face_happy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/2017-installfest/face_sad.svg b/2017-installfest/face_sad.svg new file mode 100644 index 0000000..8c4a4c1 --- /dev/null +++ b/2017-installfest/face_sad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/2017-installfest/git.eps b/2017-installfest/git.eps new file mode 100644 index 0000000..47500ce Binary files /dev/null and b/2017-installfest/git.eps differ diff --git a/2017-installfest/makefile b/2017-installfest/makefile new file mode 100644 index 0000000..9ab8f60 --- /dev/null +++ b/2017-installfest/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/2017-installfest/pres.pdf b/2017-installfest/pres.pdf new file mode 100644 index 0000000..af41431 Binary files /dev/null and b/2017-installfest/pres.pdf differ diff --git a/2017-installfest/pres.tex b/2017-installfest/pres.tex new file mode 100644 index 0000000..1c36c4c --- /dev/null +++ b/2017-installfest/pres.tex @@ -0,0 +1,304 @@ +\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čí} +\date{4.3.2017} + +\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/2017-installfest/scheme.svg b/2017-installfest/scheme.svg new file mode 100644 index 0000000..d0ab1c8 --- /dev/null +++ b/2017-installfest/scheme.svg @@ -0,0 +1,1170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/2017-installfest/scheme/Gorilla-server.svg b/2017-installfest/scheme/Gorilla-server.svg new file mode 100644 index 0000000..7fab2d9 --- /dev/null +++ b/2017-installfest/scheme/Gorilla-server.svg @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/2017-installfest/scheme/Laptop_font_awesome.svg b/2017-installfest/scheme/Laptop_font_awesome.svg new file mode 100644 index 0000000..edd1dea --- /dev/null +++ b/2017-installfest/scheme/Laptop_font_awesome.svg @@ -0,0 +1,59 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/2017-installfest/scheme/desktop-computer-with-screen-vector-icon.eps b/2017-installfest/scheme/desktop-computer-with-screen-vector-icon.eps new file mode 100644 index 0000000..7b7d251 Binary files /dev/null and b/2017-installfest/scheme/desktop-computer-with-screen-vector-icon.eps differ diff --git a/2017-installfest/scheme/smartphone-call.svg b/2017-installfest/scheme/smartphone-call.svg new file mode 100644 index 0000000..a9b0186 --- /dev/null +++ b/2017-installfest/scheme/smartphone-call.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/2017-installfest/scheme/turris_omnia.png b/2017-installfest/scheme/turris_omnia.png new file mode 100644 index 0000000..d89d93c Binary files /dev/null and b/2017-installfest/scheme/turris_omnia.png differ diff --git a/2017-installfest/syncthing.png b/2017-installfest/syncthing.png new file mode 100644 index 0000000..d644c4a Binary files /dev/null and b/2017-installfest/syncthing.png differ -- cgit v1.2.3