Skip to content

Instantly share code, notes, and snippets.

View juliennonin's full-sized avatar
🗿

Julien Nonin juliennonin

🗿
View GitHub Profile
@juliennonin
juliennonin / keybindings.json
Last active July 29, 2022 14:09
[VSCode][config] VSCode Settings, "en vrac"
[
{
"key": "ctrl+alt+[Period]",
"command": "breadcrumbs.focus",
"when": "breadcrumbsPossible"
},
{
"key": "ctrl+[Period]",
"command": "-breadcrumbs.focus",
"when": "breadcrumbsPossible"
@juliennonin
juliennonin / .bashrc
Last active July 30, 2022 15:16
[Linux][config] Configuration for custom PS1 (different behavior for git repo, and Python environments) and tab title in gnome-terminal
# >>> custom prompt PS1 >>>
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM=auto
TRIANGLE_SYM=$'\ue0b0'
function prompt_func() {
# IMPORTANT: Non-printable sequences should be enclosed in \[ and \]
if [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then # inside a git repo
gitsubdir=$(basename $(git rev-parse --show-toplevel))/$(git rev-parse --show-prefix)

Extract a set of pages:

gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dFirstPage=294 -dLastPage=523 -sOutputFile=output.pdf input.pdf

Merge a group of pdf files into one:

gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=combined.pdf part1.pdf part2.pdf part3.pdf

Remove existing bookmarks

Just "print" your pdf in pdf format!

  • create an empty env conda create -n new_env
  • activate it conda activate new_env
  • add conda-forge as the first channel conda config --env --add channels conda-forge
  • ensure that conda-forge is used if the package is available conda config --env --set channel_priority strict
  • install packagesconda install pandas scikit-learn matplotlib
@juliennonin
juliennonin / LaTeX-config.md
Last active August 24, 2021 08:02
LaTeX settings

Find packages already installed / to install:

apt list --installed | grep texlive
apt-cache search texlive

Packages:

sudo apt-get install texlive
sudo apt-get install texlive-science texlive-plain-generic texlive-pictures texlive-latex-extra texlive-lang-european texlive-lang-french texlive-fonts-extra texlive-extra-utils 
@juliennonin
juliennonin / circle.rq
Last active August 6, 2020 13:24
[GeoSparQL][diffuseur.datatourisme.gouv.fr][isLocatedAt] Datatourism request
PREFIX geo: <http://www.bigdata.com/rdf/geospatial#>
CONSTRUCT {
?res <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:resource>.
} WHERE {
<http://www.bigdata.com/queryHints#Query> <http://www.bigdata.com/queryHints#optimizer> "None".
?res <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.datatourisme.gouv.fr/ontology/core#PointOfInterest>.
?res <https://www.datatourisme.gouv.fr/ontology/core#isLocatedAt> ?5f2bf19f87ae4.
?5f2bf19f87ae4 <http://schema.org/geo> ?poi.
{
SERVICE geo:search {
@juliennonin
juliennonin / bivariate_normal_confidence_ellipse.py
Last active August 5, 2020 06:39
[gaussian][ellipse][PDA][QDA] Plot confidence level-line (ellipse) of a bivariate normal distribution
#!/usr/bin/env python3
# Julien Nonin
#%%
import numpy as np
from numpy import linalg as la
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
def plot_confidence_ellipse(mu, cov, alph, ax, clabel=None, label_bg='white', **kwargs):
@juliennonin
juliennonin / R_for_Jupyter.r
Last active January 12, 2020 12:55
Using R in Juputer Notebook
# You can install the `IRkernel` package using the following lines in an R console:
install.packages(c('rzmq','repr','IRkernel','IRdisplay'),
repos = c('http://irkernel.github.io/',
getOption('repos')),
type = 'source')
# Don't forget to make the kernel available to Jupyter!
IRkernel::installspec() # user=FALSE to install system-wide

Converting TikZ / SVG into PNG

\documentclass[varwidth]{standalone}
\usepackage{graphicx, import ,xcolor, tikz}

\begin{document}
\begin{tikzpicture}
  \draw [step=0.5] (-1.4,-1.4) grid (1.4,1.4);
\end{tikzpicture}