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 / Readme
Created August 10, 2016 05:29
Matplotlib styles for (almost) publication-ready figures
Download the files into <matplotlib config directory>/stylelib/. You can find out your matplotlib config directory using `matplotlib.get_configdir()` in a python shell. It is usually `~/.config/matplotlib`
You can then restart your python shell or run `matplotlib.style.reload_library()` to reload the style library.
Read more about how to use them at http://matplotlib.org/users/style_sheets.html#composing-styles.
@cphyc
cphyc / Readme
Created August 5, 2016 03:41
Nemo magical converter
Just store these two files in your ~/.local/share/nemo/actions folder and they will magically appear once you select one or more files in nemo!
Btw, do whatever you want, there's no license on that.
@cphyc
cphyc / minimal_path.py
Created July 21, 2016 16:53
Compute the minimal path that uniquely expands to your path.
import os
path = os.getcwd()
dir_path = path
abbrev_path = []
while True:
if dir_path == os.environ['HOME']:
abbrev_path.insert(0, '~')
break
@cphyc
cphyc / License.txt
Last active March 30, 2016 11:47
Get IAP calendar
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@cphyc
cphyc / latexify.py
Created December 16, 2015 22:32
Script to
%matplotlib inline
import pandas as pd
import matplotlib
try:
import mpld3
except:
pass
def latexify(fig_width=None, fig_height=None, columns=1, max_height_inches=8.0):
"""Set up matplotlib's RC params for LaTeX plotting.
@cphyc
cphyc / notes.tex
Created September 25, 2015 10:09
Class for lecture notes
\ProvidesClass{notes}
% Color
\RequirePackage{color}
% Maths
\RequirePackage{amsmath}
\RequirePackage{amssymb}
% Inherit from article
@cphyc
cphyc / synchronize.sh
Last active April 18, 2020 13:40
Synchronize local and remote folders
#!/bin/sh
# License: CC0 1.0 Universal license
# Legal code: https://creativecommons.org/publicdomain/zero/1.0/legalcode
# You can copy, modify, distribute and perform the work, even for commercial purposes,
# all without asking permission.
#
# This script reads an exclusion list (see below for format) in ~/.rsync/exclude
# and transfers ALL files contained in your home to the remote host using rsync as a backend
#
# The script creates on the server a unique exact copy of your HOME each time you call it. To
@cphyc
cphyc / sync_thunderbird.sh
Created August 18, 2015 09:05
Synchronize thunderbird
#!/bin/sh
FROM=/path/to/local/thunderbird/profile
TO=/path/to/remote/thunderbird/profile
rsync -rv --include="*.dat" --include="*/" --exclude="*Mail/***" --include="/*" $FROM $TO
@cphyc
cphyc / angular-yjs.js
Last active August 29, 2015 14:22
This is a angular module for yjs.
/*
* you need an easyRTCService that exposes the following methods :
* - myEasyrtcid
* - connection() promise
* - addDataChannelOpenListener
* - addPeerListener
* - addDataChannelCloseListener
* - sendData
* - broadcastData
*
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Yjs test</title>
<script src="jquery.min.js"></script>
<script src="bower_components/webcomponentsjs/webcomponents.js"></script>
<script src="bower_components/yjs/y.js"></script>
<script src="bower_components/yjs/y-object.js"></script>
<script src="bower_components/y-list/y-list.js"></script>