Skip to content

Instantly share code, notes, and snippets.

@naomi-henderson
naomi-henderson / ERA5-catalog.ipynb
Created January 29, 2020 16:59
How to use the pangeo-ERA5 catalog
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@naomi-henderson
naomi-henderson / CMIP5-MakeFigs-June20.ipynb
Last active April 29, 2020 23:42
June 20 version of the CMIP5-MakeFigs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tmspzz
tmspzz / NRFileManager.swift
Last active December 12, 2023 06:46
A method to calculate the accumulated size of a directory on the volume in bytes.
public extension FileManager {
/// This method calculates the accumulated size of a directory on the volume in bytes.
///
/// As there's no simple way to get this information from the file system it has to crawl the entire hierarchy,
/// accumulating the overall sum on the way. The resulting value is roughly equivalent with the amount of bytes
/// that would become available on the volume if the directory would be deleted.
///
/// - note: There are a couple of oddities that are not taken into account (like symbolic links, meta data of
/// directories, hard links, ...).
ncflint -A -C -v ubar_north,vbar_north,u_north,v_north,ubar_west,vbar_west,u_west,v_west -w 0.0,0.0 ws4km_bry_SODA3_19890115_to_20151215_test.nc ws4km_bry_SODA3_19890115_to_20151215_test.nc test.nc
@anttilipp
anttilipp / solarzenithazimuthdemo.py
Last active April 6, 2024 09:21
Demo code to compute + visualize solar zenith angle and solar azimuth angle in Python
"""
DEMO TO COMPUTE SOLAR ZENITH ANGLE
version 6 April 2017
by Antti Lipponen
Copyright (c) 2017 Antti Lipponen
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
@lukegre
lukegre / LG_xarray_tools.py
Last active December 10, 2020 20:06
function that takes the trend for an xarray.DataArray over the 'time' variable. Returns the slopes and p-values for each location.
def dataset_encoding(xds):
cols = ['source', 'original_shape', 'dtype', 'zlib', 'complevel', 'chunksizes']
info = pd.DataFrame(columns=cols, index=xds.data_vars)
for row in info.index:
var_encoding = xds[row].encoding
for col in info.keys():
info.ix[row, col] = var_encoding.pop(col, '')
return info
@maxsz
maxsz / DelayedBlockOperation.swift
Last active October 26, 2018 11:21
Delayed NSOperation
class DelayedBlockOperation: NSOperation {
private var delay: NSTimeInterval = 0
private var block: (() -> Void)? = nil
private var queue: dispatch_queue_t = dispatch_get_main_queue()
override var asynchronous: Bool { return true }
override var executing : Bool {
get { return _executing }
set {
willChangeValueForKey("isExecuting")
@kevinelliott
kevinelliott / osx-10.11-setup.md
Last active April 10, 2022 15:47
Mac OS X 10.11 El Capitan Setup

Mac OS X 10.11 El Capitan

Custom recipe to get OS X 10.11 El Capitan running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.10 Yosemite setup recipe (as found on this gist https://gist.github.com/kevinelliott/0726211d17020a6abc1f). Note that I expect this to change significantly as I install El Capitan several times.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

@couchdeveloper
couchdeveloper / transform_each.m
Last active October 30, 2016 09:50
Asynchronous Pattern with GCD Part I
/**
Objective:
Asynchronously transform or process an array of items - one after the
other and return the result of each transform in an array.
Synopsis:
void transform_each(NSArray* inArray, unary_async_t task, completion_t completion);
@gavrix
gavrix / gist:5054182
Created February 28, 2013 04:28
Script integrating OCLint into XCode. Put it in "Run script" build phase.
source ~/.bash_profile
hash oclint &> /dev/null
if [ $? -eq 1 ]; then
echo >&2 "oclint not found, analyzing stopped"
exit 1
fi