Table of Contents

List of useful shortcuts and tricks

Clavier Mx keys mini

Essentiel

Brave

Tig

Python

Python et Emacs

Jupyter et Emacs

Latex

Vs Code

Installer l'extension bookmarks puis

Sumatra

Dokuwiki

Git et Notebook

Pour utiliser Git et Notebook, il faut d'abord s'assurer qu'au moment Git push on n'inclue pas les outputs, ce qui permet d'eviter les conflits… Il y a le module nbstripout qui permet de faire ca automatiquement. Si on a pas encore installé nbstripout, faire le 1. Sinon, on passe directement à l'étape 2.

  1. Installation de nbstripout. Pour installer module nbstripout
    • dans python,
      python3.10 -m pip install --upgrade nbstripout 
    • si on a conda: conda install -c conda-forge nbstripout
  2. Une fois nbstripout installé. Ouvrir Anaconda prompt. A partir d'Anaconda Prompt, se placer dans le répertoire Git où figure le notebook et taper
nbstripout --install --attributes .gitattributes 

Git

Chrome

Termux

if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then tmux attach -t default || tmux new -s default fi fi

Emacs

Convention de notation: C pour Ctrl et M pour Alt

Elpy (Python in Emacs)

Sur Emacs

Dans le shell interpreter

Code python

format.py
import re
 
def replace_symbols(source_file, destination_file):
    try:
        with open(source_file, 'r') as source:
            with open(destination_file, 'w') as destination:
                content = source.read()
 
              # Remplacer les parties entre double dollars (comme $$...$$) par leurs équivalents \[...\]
                content = re.sub(r'\$\$(.*?)\$\$', r'\\[\1\\]', content, flags=re.DOTALL)
              # Remplacer les parties entre dollars (comme $...$) par leurs équivalents \(...\)
                content = re.sub(r'\$(.*?)\$', r'\\(\1\\)', content, flags=re.DOTALL)
 
 
                destination.write(content)
 
    except FileNotFoundError:
        print("Fichier source non trouvé.")
    except Exception as e:
        print("Une erreur est survenue :", str(e))
    else:
        print("Remplacement terminé avec succès!")
 
# Exemple d'utilisation
source_file = "exos.tex"
destination_file = "sortie.tex"
replace_symbols(source_file, destination_file)

settings.json pour VsCode

settings.json
{
    // "latex-workshop.synctex.synctexjs.enabled": true,
    "latex-workshop.synctex.afterBuild.enabled": true,
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
    "security.workspace.trust.untrustedFiles": "open",
    "latex-workshop.view.pdf.zoom": "page-width",
    "editor.wordWrap": "on",
    "latex-workshop.view.pdf.tab.editorGroup": "below",
    "editor.bracketPairColorization.enabled": true,
    "latex-workshop.message.update.show": false,
    "latex-workshop.message.warning.show": false,
    "latex-workshop.message.error.show": false,
    "latex-workshop.message.information.show": false,
    "git.confirmSync": false,
    "git.untrackedChanges": "hidden",
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "workbench.editorAssociations": {
        "*.ipynb": "jupyter-notebook"
    },
    "notebook.cellToolbarLocation": {
        "default": "right",
        "jupyter-notebook": "left"
    },
    "python.defaultInterpreterPath": "C:\\Users\\douc_ran\\Anaconda3\\python.exe",
    "mdmath.macroFile": "C:\\Users\\douc_ran\\OneDrive\\mymacros.json",
    "editor.fontSize": 11,
    "editor.suggest.showStatusBar": true,
    "editor.suggest.insertMode": "insert",
    "markdown.extension.katex.macros": {
    "\\PP": "\\mathbb{P}"
    },
    "window.zoomLevel": 1,
    "latex-workshop.view.pdf.external.synctex": {
        "command": "C:\\Users\\douc_ran\\AppData\\Local\\SumatraPDF",
        "args": [
            "-forward-search",
            "%TEX%",
        "%LINE%",
        "-reuse-instance",
        "-inverse-search",
            "code \"C:\\Users\\douc_ran\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\outcli.js\" -r -g \"%f:%l\"",
        "%PDF%",
        ]
    },
    "[python]": {
        "editor.formatOnType": true
    },
    "git.openRepositoryInParentFolders": "always",
    "lightrun.certificatePinningList": [
        "515a630cfd1fb908e30087bcc20b7413ad146b9bf2b23d3aaa72c28e45b24fb2",
        "ee80811b38e7e6c2dc4cc372cbea86bd86b446b012e427f2e19bf094afba5d12"
    ],
    "lightrun.serverURL": "https://app.lightrun.com",
    "lightrun.sendSourceFullPath": true,
    "git-graph.maxDepthOfRepoSearch": 1,
    "git.autofetch": true,
    "jupyter.interactiveWindow.creationMode": "perFile",
    "latex-workshop.latex.recipes": [
        {
          "name": "latexmk",
          "tools": [
            "latexmk"
          ]
        },
        {
            "name": "latex-dvi-ps-pdf",
            "tools": [
              "latex",
              "dvips",
              "ps2pdf"
            ]
          },
        {
            "name": "pdflatex",
            "tools": [
              "pdflatex"
            ]
        },
    ],
    "latex-utilities.liveReformat.snippets": [
        {
            "prefix": "([A-Za-z}\\)\\]])(\\d)$",
            "body": "$1_$2",
            "mode": "maths",
            "triggerWhenComplete": true,
            "description": "auto subscript"
        },
        {
            "prefix": "([A-Za-z}\\)\\]]) ?_(\\d\\d)$",
            "body": "$1_{$2}",
            "mode": "maths",
            "triggerWhenComplete": true,
            "description": "auto escape subscript"
        },
        {
            "prefix": "(\\S) ([\\^_])$",
            "body": "$1$2",
            "mode": "maths",
            "triggerWhenComplete": true,
            "description": "remove extraneous sub/superscript space",
            "priority": 2
        },
        {
            "prefix": "([A-Za-z}\\)\\]]) ?\\^ ?(\\d\\d|[\\+\\-] ?(?:\\d|[A-Za-z]|\\\\\\w+))$",
            "body": "$1^{$2}",
            "mode": "maths",
            "triggerWhenComplete": true,
            "description": "auto escape superscript",
            "priority": 2
        },
        {
            "prefix": "([^ &\\\\\\+\\-=<>\\|!~@])([\\+\\-=<>])$",
            "body": "$1 $2",
            "mode": "maths",
            "priority": -1,
            "description": "whitespace before operators",
            "triggerWhenComplete": true
        },
        {
            "prefix": "([\\+\\-=<>])([^ &\\\\\\+\\-=<>\\|!~])$",
            "body": "$1 $2",
            "mode": "maths",
            "priority": -1,
            "description": "whitespace after operators",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\.\\.\\.$",
            "body": "\\dots ",
            "mode": "maths",
            "description": "⋯",
            "triggerWhenComplete": true
        },
        {
            "prefix": "=>$",
            "body": "\\implies ",
            "mode": "maths",
            "description": "⇒",
            "triggerWhenComplete": true
        },
        {
            "prefix": "=<$",
            "body": "\\impliedby ",
            "mode": "maths",
            "description": "implied by",
            "triggerWhenComplete": true
        },
        {
            "prefix": "//$",
            "body": "\\frac{$$1}{$$2} ",
            "mode": "maths",
            "description": "fraction (empty)",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(([\\d\\.]+)|([\\d\\.]*)(\\\\)?([A-Za-z]+)((\\^|_)(\\{\\d+\\}|\\d|[A-Za-z]|\\\\\\w+))*!?)\\/$",
            "body": "\\frac{$1}{$$1}$$0",
            "mode": "maths",
            "description": "fraction (from regex)",
            "triggerWhenComplete": true
        },
        {
            "prefix": "([\\)\\]}]) ?/$",
            "body": "SPECIAL_ACTION_FRACTION",
            "mode": "maths",
            "description": "fraction (parsed)",
            "triggerWhenComplete": true,
            "noPlaceholders": false
        },
        {
            "prefix": "sympy$",
            "body": "sympy $$1 sympy",
            "mode": "maths",
            "description": "sympy block",
            "triggerWhenComplete": false
        },
        {
            "prefix": "sympy.+$",
            "body": "SPECIAL_ACTION_BREAK",
            "mode": "maths",
            "triggerWhenComplete": true,
            "priority": 2
        },
        {
            "prefix": "sympy ?(.+?) ?sympy ?$",
            "body": "SPECIAL_ACTION_SYMPY",
            "mode": "maths",
            "priority": 3,
            "description": "sympy",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(^|[^\\\\])\\biff$",
            "body": "$1\\iff ",
            "mode": "maths",
            "description": "⇔",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(^|[^\\\\])\\binn$",
            "body": "$1\\in ",
            "mode": "maths",
            "description": "in",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(^|[^\\\\])\\bnotin$",
            "body": "$1\\not\\in ",
            "mode": "maths",
            "description": "∈",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?!=$",
            "body": " \\neq ",
            "mode": "maths",
            "description": "neq",
            "triggerWhenComplete": true
        },
        {
            "prefix": "==$",
            "body": "&= ",
            "mode": "maths",
            "description": "aligned equal",
            "priority": 1,
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?~=$",
            "body": " \\approx ",
            "mode": "maths",
            "description": "≈",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?~~$",
            "body": " \\sim ",
            "mode": "maths",
            "description": "∼",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?>=$",
            "body": " \\geq ",
            "mode": "maths",
            "description": "≥",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?<=$",
            "body": " \\leq ",
            "mode": "maths",
            "description": "≤",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?>>$",
            "body": " \\gg ",
            "mode": "maths",
            "description": "≫",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?<<$",
            "body": " \\ll ",
            "mode": "maths",
            "description": "≪",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?xx$",
            "body": " \\times ",
            "mode": "maths",
            "description": "×",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?\\*\\*$",
            "body": " \\cdot ",
            "mode": "maths",
            "description": "⋅",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(^|[^\\\\]\\b|[ ,\\)\\]\\}]\\w*)(to|->)$",
            "body": "$1\\to ",
            "mode": "maths",
            "description": "→",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?(?:\\|->|!>)$",
            "body": " \\mapsto ",
            "mode": "maths",
            "description": "↦",
            "priority": 1.1,
            "triggerWhenComplete": true
        },
        {
            "prefix": "(^|[^\\\\])a(?:rc)?(sin|cos|tan|cot|csc|sec)$",
            "body": "$1\\arc$2 ",
            "mode": "maths",
            "description": "arc(trig)",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(^|[^\\\\])(sin|cos|tan|cot|csc|sec|min|max|log|exp)$",
            "body": "$1\\$2 ",
            "mode": "maths",
            "description": "un-backslashed operator",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(^|[^\\\\])(pi)$",
            "body": "$1\\$2",
            "mode": "maths",
            "description": "pi",
            "triggerWhenComplete": true
        },
        {
            "prefix": "((?:\\b|\\\\)\\w{1,7})(,\\.|\\.,)$",
            "body": "\\vec{$1}",
            "mode": "maths",
            "description": "vector",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(\\\\?[\\w\\^]{1,7})~ $",
            "body": "\\tilde{$1}",
            "mode": "maths",
            "description": "tilde",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(\\\\?[\\w\\^]{1,7})\\. $",
            "body": "\\dot{$1}",
            "mode": "maths",
            "description": "dot",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(\\\\?[\\w\\^]{1,7})\\.\\. $",
            "body": "\\ddot{$1}",
            "mode": "maths",
            "description": "ddot",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\bbar$",
            "body": "\\overline{$$1}",
            "mode": "maths",
            "description": "overline",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\b(\\\\?[\\w\\^{}]{1,3})bar$",
            "body": "\\overline{$1}",
            "mode": "maths",
            "description": "overline",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(^|[^\\\\])\\bhat$",
            "body": "$1\\hat{$$1}",
            "mode": "maths",
            "description": "hat",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\b([\\w\\^{}])hat$",
            "body": "\\hat{$1}",
            "mode": "maths",
            "description": "hat",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\\\\\)(\\w)$",
            "body": "\\) $1",
            "mode": "any",
            "description": "space after inline maths",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\\\\\\\\\\\$",
            "body": "\\setminus ",
            "mode": "maths",
            "description": "∖ (setminus)",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\bpmat$",
            "body": "\\begin{pmatrix} $$1 \\end{pmatrix} ",
            "mode": "maths",
            "description": "pmatrix",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\bbmat$",
            "body": "\\begin{bmatrix} $$1 \\end{bmatrix} ",
            "mode": "maths",
            "description": "bmatrix",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\bpart$",
            "body": "\\frac{\\partial $${1:V}}{\\partial $${2:x}} ",
            "mode": "maths",
            "description": "partial derivative",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\bsq$",
            "body": "\\sqrt{$$1}",
            "mode": "maths",
            "description": "√",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?sr$",
            "body": "^2",
            "mode": "maths",
            "description": "²",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?cb$",
            "body": "^3",
            "mode": "maths",
            "description": "³",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\bEE$",
            "body": "\\exists ",
            "mode": "maths",
            "description": "∃",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\bAA$",
            "body": "\\forall ",
            "mode": "maths",
            "description": "∀",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\b([A-Za-z])([A-Za-z])\\2$",
            "body": "$1_$2",
            "mode": "maths",
            "description": "subscript letter",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\b([A-Za-z])([A-Za-z])\\2?p1$",
            "body": "$1_{$2+1}",
            "mode": "maths",
            "description": "subscript letter + 1",
            "priority": 2,
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\bdint$",
            "body": "\\int_{$${1:-\\infty}}^{$${2:\\infty}} ",
            "mode": "maths",
            "description": "∫ₐᵇ",
            "triggerWhenComplete": true
        },
        {
            "prefix": "([^ \\\\])  $",
            "body": "$1\\, ",
            "mode": "maths",
            "description": "add maths whitespace \\,",
            "priority": -1,
            "triggerWhenComplete": true
        },
        {
            "prefix": "([^ \\\\])\\\\, {2,4}$",
            "body": "$1\\: ",
            "mode": "maths",
            "description": "add maths whitespace \\:",
            "priority": 0.1,
            "triggerWhenComplete": true
        },
        {
            "prefix": "([^ \\\\])\\\\: {2,4}$",
            "body": "$1\\; ",
            "mode": "maths",
            "description": "add maths whitespace \\;",
            "priority": 0.2,
            "triggerWhenComplete": true
        },
        {
            "prefix": "([^ \\\\])\\\\; {2,4}$",
            "body": "$1\\ ",
            "mode": "maths",
            "description": "add maths whitespace \\ ",
            "priority": 0.3,
            "triggerWhenComplete": true
        },
        {
            "prefix": "([^ \\\\])\\\\ {2,4}$",
            "body": "$1\\quad ",
            "mode": "maths",
            "description": "add maths whitespace quad",
            "priority": 0.4,
            "triggerWhenComplete": true
        },
        {
            "prefix": "([^ \\\\])\\\\quad {2,4}$",
            "body": "$1\\qquad ",
            "mode": "maths",
            "description": "add maths whitespace qquad",
            "priority": 0.5,
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\bset$",
            "body": "\\\\{$$1\\\\} ",
            "mode": "maths",
            "description": "set {}",
            "triggerWhenComplete": true
        },
        {
            "prefix": " ?\\|\\|$",
            "body": " \\mid ",
            "mode": "maths",
            "description": "∣",
            "triggerWhenComplete": true
        },
        {
            "prefix": "< ?>$",
            "body": "\\diamond ",
            "mode": "maths",
            "description": "⋄",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\bcase$",
            "body": "\\begin{cases} $$1 \\end{cases} ",
            "mode": "maths",
            "description": "cases",
            "triggerWhenComplete": true
        },
        {
            "prefix": "(^|[^\\\\])\\bst$",
            "body": "$1\\text{s.t.} ",
            "mode": "maths",
            "description": "such that",
            "triggerWhenComplete": true
        },
        {
            "prefix": "\\+ ?-$",
            "body": "\\pm ",
            "mode": "maths",
            "description": "±",
            "priority": 1,
            "triggerWhenComplete": true
        },
        {
            "prefix": "- ?\\+$",
            "body": "\\mp ",
            "mode": "maths",
            "description": "∓",
            "priority": 1,
            "triggerWhenComplete": true
        },
        {
            "prefix": "(?:([A-Za-z0-9]|\\\\\\w{,7})|\\(([^\\)]+)\\))C(?:([A-Za-z0-9]|\\\\\\w{,7})|\\(([^\\)]+)\\))$",
            "body": "\\binom{$1$2}{$3$4}",
            "mode": "maths",
            "priority": 2,
            "description": "binomial",
            "triggerWhenComplete": true
        }
    ],
    "editor.minimap.enabled": false,
    "redhat.telemetry.enabled": false,
    "spellright.language": [
        "fr"
    ],
    "spellright.documentTypes": [
        "markdown",
        "plaintext"
    ],
    "interactiveWindow.executeWithShiftEnter": true,
    "lightrun.deploymentName": "default",
    "files.autoSave": "afterDelay"
 
}