Skip to content

Instantly share code, notes, and snippets.

View cphyc's full-sized avatar

Corentin Cadiou cphyc

  • Lund University
  • Lund, Sweden
  • X @cphyc
View GitHub Profile
@cphyc
cphyc / colorblind-4.mplstyle
Last active November 6, 2020 16:07
Matplotlib palettes
# Colorblind palette - 4 items
# From https://davidmathlogic.com/colorblind/
axes.prop_cycle: cycler("color", ["E69F00", "56B4E9", "009E73", "F0E442"])
#-#-#-#-#-#-#-#
# ~/.XCompose
# To change the US International keyboard layout to behave like the
# Microsoft Windows (TM) version of the layout
# Original by @tamh [48bytes at gmail com]
#
# Modified to suite French typing (all composition are deactivated but those with a and e)
# Modified by @cphyc
#
# Released under GPL v3+. Please refer to it by going to:
#!/usr/bin/env python
import sys
import os
import argparse
from datetime import datetime
try:
import requests
from scipy.interpolate import interp1d
import pandas as pd
@cphyc
cphyc / .gitconfig
Last active September 4, 2019 14:29
[alias]
c = commit
ca = commit --amend
chp = cherry-pick
co = checkout
df = diff --word-diff
lg = log --oneline
prb = pull --rebase
st = status -s
br = "!git branch --color | tee"
push @extra_pdflatex_options, '-synctex=1' ;
push @extra_pdfps_options, '-synctex=1' ;
push @extra_latex_options, '-synctex=1' ;
$latex = 'latex -interaction=nonstopmode -shell-escape';
$pdflatex = 'pdflatex -interaction=nonstopmode -shell-escape';
$pdf_mode=1;
# Making glossaries
add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' );
sub makeglossaries {
% \documentclass{standalone}
% \usepackage{tikz}
% \usetikzlibrary{arrows,decorations.pathreplacing,positioning,calc}
% \usepackage{ifthen}
% \usepackage{siunitx}
% \begin{document}
\def\w{8}
\def\Nstep{6}
\def\dh{0.5}
\begin{tikzpicture}
@cphyc
cphyc / octree_gradients.py
Last active May 3, 2019 12:18
Compute gradients for octree dataset in yt
def add_deposited_gradient_field(ds, gradient_field, direction, ptype):
'''Add a gradient field, evaluated at the location of particle
Parameters
----------
ds : Dataset
gradient_field : tuple
The field to compute the gradient of (ftype, fname), e.g. ("gas", "pressure")
direction : str
The gradient direction (x, y or z)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cphyc
cphyc / Untitled1.ipynb
Last active August 30, 2018 13:01
Untitled1.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.