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 / yt.sh
Last active February 14, 2018 18:16
yt autocompletion
# yt command line autocompletion
#
# This requires https://github.com/scop/bash-completion as well as http://github.com/yt-project/yt.
#
# To use, save it somewhere and source it (e.g. from your .bashrc). For example in your .bashrc add
# source ~/.yt-autocompletion
_yt()
{
local cur prev words cword split
@cphyc
cphyc / nfw.py
Created December 12, 2017 13:29
Solve equation of movement including shell crossing
import numpy as np
from astropy import constants as C
from tqdm import tqdm
import os
import h5py
N = 10000
nsteps = 1_000
iout = 10
@cphyc
cphyc / clip_magic.py
Last active December 8, 2018 11:49 — forked from nova77/clip_magic.py
copy to clipboard ipython magic
"""
Add copy to clipboard from IPython!
To install, just copy it to your profile/startup directory, typically:
~/.ipython/profile_default/startup/
Example usage:
%clip hello world
# will store "hello world"
@cphyc
cphyc / watch_count
Last active May 31, 2017 15:35
Follow the number of files created
#!/usr/bash
# To use:
# watch_count PATTERN [ARGS...]
# It will match the PATTERN and pass any remaining args to tqdm (that
# you need btw)
function watch_count {
pattern=$1
shift
curr=0
@cphyc
cphyc / Simple GRF.ipynb
Last active April 20, 2017 13:39
Simple GRF.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cphyc
cphyc / Random field generation.ipynb
Last active April 6, 2017 13:52
Random field generation.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cphyc
cphyc / watch-svn
Last active July 6, 2022 13:25
SVN Monitor: monitor a repository and send a notification whenever a new commit is pushed
#!/usr/bin/env bash
#
# This tool is only working with SVN. I *strongly* advise to use git or mercurial for your everyday work.
# However, somteimes you're stuck with SVN so here's a small script to make your life easier :)
#
# This script is under the MIT license.
# 2017 - cphyc
# Preset parameters
NOTIFYCMD=notify-send
@cphyc
cphyc / Map of matter around filaments.ipynb
Last active April 4, 2017 14:36
Map of matter around a filament's center
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cphyc
cphyc / Correlation functions - power law - simplified.ipynb
Last active April 4, 2017 08:51
Correlation functions - power law - simplified.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cphyc
cphyc / math.fish
Last active November 7, 2016 10:22
Fish function to evaluate expression as mathematics
# to install, create the following function using
# $ funced __fish_command_not_found_handler
# then save it using:
# $ funcsave __fish_command_not_found_handler
function __fish_command_not_found_handler --on-event fish_command_not_found
set -l __packages (pkgfile --binaries --verbose -- $argv[1] ^/dev/null)
if test $status -eq 0
printf "%s may be found in the following packages:\n" "$argv[1]"
printf " %s\n" $__packages