Skip to content

Instantly share code, notes, and snippets.

@navidcy
navidcy / gist:b7723dc9582383282ec59434b039c6bc
Created March 9, 2018 16:00
delete local git branch that are not on remote
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
@navidcy
navidcy / .inputrc
Created July 20, 2018 21:34
bash history search, partial + up-arrow
## This allows for bash history search, partial + up-arrow
## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@navidcy
navidcy / process_dask_minimaxexample-3.ipynb
Last active March 18, 2019 00:17
Dask memory problem
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@navidcy
navidcy / dask_PBSCluster_MinimalExample.ipynb
Created May 15, 2019 06:54
A minimal example for dask_PBSCluster
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@navidcy
navidcy / diagnostics_on_gpu.jl
Last active May 2, 2020 06:52
a script to investigate slowdown for diagnostics when running on GPU
using FourierFlows, PyPlot, Printf, Random
using Random: seed!
using FFTW: rfft, irfft
import GeophysicalFlows.TwoDNavierStokes
import GeophysicalFlows.TwoDNavierStokes: energy, enstrophy
import GeophysicalFlows: peakedisotropicspectrum
using FourierFlows, Printf, Random
using Random: seed!
using FFTW: rfft, irfft
import GeophysicalFlows.TwoDNavierStokes
import GeophysicalFlows.TwoDNavierStokes: energy, enstrophy
import GeophysicalFlows: peakedisotropicspectrum
@navidcy
navidcy / gist:5034891d186f65e2f0bcaab1141b3442
Last active September 7, 2020 23:27
Merge output from multiple IAF cycles that all start at 1958
# loat temp data from the two IAF cycles
temp_cycle1 = cc.querying.getvar('01deg_jra55v140_iaf', 'temp', session, ncfile='ocean-3d-temp-1-monthly-mean-ym_%.nc')
temp_cycle2 = cc.querying.getvar('01deg_jra55v140_iaf_cycle2', 'temp', session, ncfile='ocean-3d-temp-1-monthly-mean-ym_%.nc')
# The above data arrays have monthly temporal resolution.
# We would like to shift the time-axis of `cycle2` so
# as to plot them as a contiguous time-series,
# find out how many months we need to shift `cycle2`
howmanymonths = str(temp_010_cycle1_IAF_all.time.size + 1) + 'M'