-
RIEHM Clement authoredRIEHM Clement authored
rendu.tex 6.84 KiB
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{graphicx}
% Pour les tableaux
\usepackage{array}
\graphicspath{ {./img/} }
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
% Info titre
\title{Outils libre coté client}
\author{Clément Riehm}
\begin{document}
\lstset{style=mystyle}
\maketitle
\tableofcontents
\section{Efficacité de l'environnement de travail}
\subsection*{\#1}
\begin{center}
\begin{tabular}{ | m{5cm} | m{5cm} | m{5cm} | }
Priorité & Problème & Correctif \\ [0.5ex]
\hline
1 & Gerer les fenetres & Utiliser un gestionnaire de fenetre comme i3, krohnite pour plasma \\
\hline
1 & Naviguer sur internet & Apprendre les raccourcis claviers. Il y a aussi des extensions pour se deplacer avec les commandes vi \\
\hline
2 & Gerer les mails & Utiliser mutt \\
\hline
3 & Gerer les connexions & Utiliser nmtui avec network manager \\
\hline
3 & Traitement de texte pas simple & Utiliser latex, markdown \\
\hline
4 & Editer du code & Utiliser vim \\
\hline
5 & Gerer les partitions avec gparted & Utiliser un éditeur sur terminal comme fdisk \\
\hline
6 & Naviguer sur une carte & Utiliser les fleches, +, - sur gnome-maps \\
\hline
\end{tabular}
\end{center}
\subsection*{\#2}
\subsection*{\#3}
vi en mode par défaut:
\begin{lstlisting}[language=bash]
echo "set editing-mode vi" > ~/.inputrc
\end{lstlisting}
Parametrer nvim en éditeur par défaut sur archlinux :
\begin{lstlisting}[language=bash]
echo "export EDITOR='nvim'" >> ~/.bashrc
\end{lstlisting}
\subsection*{\#4}
Il y avait un mot de passe dans mon history.
D'après son history l’employé a sans doute changer de shell. Il a installé zsh avant que l’history s’arrete.
Les commandes listées dans la variable HISTIGNORE sont désactivées.
\begin{lstlisting}[language=bash]
export HISTIGNORE="&:ls:exit:pwd:clear:history"
\end{lstlisting}
\subsection*{\#5}
\begin{lstlisting}[language=bash]
function mkcd()
{
mkdir $1
cd $1
}
function gitemergency()
{
git add *
git commit -m "emergency commit"
git push origin main
}
\end{lstlisting}
\subsection*{\#6}
\begin{lstlisting}[language=bash]
_backup()
{
local cur prev opts
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
local files=("${cur}"*)
case $COMP_CWORD in
1) opts=`getent passwd | cut -d: -f1`;;
2) opts="now tonight tomorrow";;
3) opts="${files[@]}";;
*);;
esac
COMPREPLY=()
COMPREPLY=( $(compgen -W "$opts" -- ${cur}) )
return 0
}
complete -o nospace -F _backup backup
\end{lstlisting}
\subsection*{\#7}
Ajouter vagrant-prompt dans la liste de plugins de ~/.zshrc
plugins=(git vagrant-prompt)
Ajouter \verb|$(vagrant_prompt_info)| au PROMPT dans le themes
\subsection*{\#8}
\subsection*{\#9}
\subsection*{\#10}
\section{SSH}
\subsection*{\#1}
\begin{lstlisting}
ssh alice@192.168.56.2
\end{lstlisting}
L'history des utilisateurs sont vides.
\subsection*{\#2}
\begin{lstlisting}
bob@srv:~$ ssh-copy-id alice@192.168.56.3
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/bob/.ssh/id_rsa.pub"
alice@192.168.56.3's password:
Number of key(s) added: 1
\end{lstlisting}
Après la copie de la clef bob peut se conecter sans le mot de passe de alice.
\begin{lstlisting}
ssh-agent
ssh-add
Ces commandes permettent de ne pas taper le mot de passe a chaque connections.
\end{lstlisting}
\subsection*{\#3.1}
\begin{lstlisting}
alice@cli:~$ ssh-keyscan 192.168.56.3 > .ssh/known_hosts
# 192.168.56.3:22 SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u7
# 192.168.56.3:22 SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u7
# 192.168.56.3:22 SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u7
alice@cli:~$ ssh bob@192.168.56.3
bob@192.168.56.3's password:
\end{lstlisting}
\subsection*{\#3.2}
\begin{lstlisting}
ArchNilux% sftp alice@192.168.56.2
alice@192.168.56.2's password:
Connected to 192.168.56.2.
sftp> put Vagrantfile
Uploading Vagrantfile to /home/alice/Vagrantfile
Vagrantfile 100% 1419 875.2KB/s 00:00
sftp> get /etc/passwd
Fetching /etc/passwd to passwd
passwd 100% 1640 534.1KB/s 00:00
sftp> ^D
sshfs alice@192.168.56.2:/home tmp
\end{lstlisting}
Le fichier a bien été modifié sur le home d'alice
\subsection*{\#4}
\includegraphics{ssh2.png}
\subsection*{\#6}
Firefox depuis une autre machine avec le x-forwarding
\includegraphics[width=10cm]{ssh3.png}
\section{Git}
\subsection*{\#1}
\begin{lstlisting}
~/git/vagrantssh $ git init
git status
vagrant up
vagrant halt
git status
\end{lstlisting}
Un dossier .vagrant est créé. L’ajouter dans le fichier gitignore pour l’ignorer.
\begin{lstlisting}[language=bash]
echo .vagrant/ >> .gitignore
git add README.md Vagrantfile srv/
git commit -m "Ajout initial"
git log
git show cdc5df9f5ec0abe55cc6d825c5c6008560199688
\end{lstlisting}
\subsection*{\#2.1}
\begin{lstlisting}[language=bash]
git checkout -b new-branche-2000
nvim Vagrantfile
git add -p
\end{lstlisting}
Les modification ne sont pas dans le working directory.
\subsection*{\#2.2}
\begin{lstlisting}[language=bash]
git checkout master
git merge new-branche-2000
git log
git show 8fa8008b2c7eeb6e55115f019b6e7ca3e439a4dd
\end{lstlisting}
Spécificité : Le HEAD -> master
\begin{lstlisting}[language=bash]
commit 8fa8008b2c7eeb6e55115f019b6e7ca3e439a4dd (HEAD -> master, new-branche-2000)
\end{lstlisting}
\begin{lstlisting}[language=bash]
git branch
* master
new-branche-2000
\end{lstlisting}
La branche existe toujours. On peut supprimer la branche.
\subsection*{\#3}
\begin{lstlisting}[language=bash]
git checkout master
git merge new-branche-2000
git log
git show 8fa8008b2c7eeb6e55115f019b6e7ca3e439a4dd
\end{lstlisting}
\subsection*{\#4}
\begin{lstlisting}[language=bash]
git checkout -b forward-new-port
\end{lstlisting}
\begin{lstlisting}[language=bash]
nvim Vagrantfile
git add Vagrantfile
git commit -m "Forward port 80"
\end{lstlisting}
\begin{lstlisting}[language=bash]
git checkout master
nvim Vagrantfile
git add Vagrantfile
git commit -m "Forward port 80"
\end{lstlisting}
\begin{lstlisting}[language=bash]
git merge forward-new-port
\end{lstlisting}
Git demande de corriger le conflit.
>>>>>>> 66d1b67b0bc81a0cb42237dfeb5ada3eb4f3cd8d
\end{document}