Skip to content

Instantly share code, notes, and snippets.

View rafaqz's full-sized avatar

Rafael Schouten rafaqz

  • Center for Macroecology, Evolution and Climate
  • Copenhagen
View GitHub Profile
fill_tile!(tile::AbstractMatrix, int_points::AbstractVector{Tuple{Int,Int}}; kw...)
Fill a tile from a region of points converted to `Integer` tuples and sorted.
# Arguments
- `tile`: A square matrix of `Int32`.
- `int_points`: A vector of integer tuple points.
# Keywords
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
using Unitful, Base.Filesystem, HDF5, Dates
using Unitful: °C, K, hr, d
using Base: tail
# Fix unitful handling of missing
import Base.*
*(::Missing, ::T) where {T<:Unitful.Units} = missing
*(::T, ::Missing) where {T<:Unitful.Units} = missing
rafaqz / makefile
Created August 3, 2018 02:29
A makefile for pandoc.
## Put this Makefle in your project directory---i.e., the directory
## containing the paper you are writing. Assuming you are using the
## rest of the toolchain here, you can use it to create .html, .tex,
## and .pdf output files (complete with bibliography, if present) from
## your markdown file.
## - Using `make` without arguments will generate html, tex, and pdf
## output files from all of the files with the designated markdown
## extension. The default is `.md` but you can change this.
## - You can specify an output format with `make tex`, `make pdf` or
## - `make html`.
rafaqz / loadraster.jl
Last active June 15, 2018 03:33
Load a world raster with ArchGDAL and crop australia
using ArchGDAL
function readtiff(file)
img = ArchGDAL.registerdrivers() do do dataset
img ./= maximum(img)
img .= max.(0.0, img)
julia> sol = solve(prob, FunctionMap(scale_by_time = true)); nothing
ERROR: UndefVarError: photosynthesize not defined
[1] assimilation!(::DynamicEnergyBudgets.Organ{DynamicEnergyBudgets.StatePVMCNE{Unitful.Quantity{Float64,Unitful.Dimensions{(Unitful.Dimension{:Amount}(1//1),)},Unitful.FreeUnits{(Unitful.Unit{:Mole,Unitful.Dimensions{(Unitful.Dimension{:Amount}(1//1),)}}(0, 1//1),),Unitful.Dimensions{(Unitful.Dimension{:Amount}(1//1),)}}}},DynamicEnergyBudgets.Params{Unitful.Quantity{Float64,Unitful.Dimensions{(Unitful.Dimension{:Amount
}(-1//1), Unitful.Dimension{:Mass}(1//1))},Unitful.FreeUnits{(Unitful.Unit{:Gram,Unitful.Dimensions{(Unitful.Dimension{:Mass}(1//1),)}}(0, 1//1), Unitful.Unit{:Mole,Unitful.Dimensions{(Unitful.Dimension{:Amount}(1//1),)}}(0, -1//1)),Unitful.Dimensions{(Unitful.Dimension{:Amount}(-1//1), Unitful.Dimension{:Mass}(1//1))}}},DynamicEnergyBudgets
rafaqz / fortran-julia.jl
Last active March 17, 2024 21:34
Fortran-Julia conversion script
This julia script converts fortran 90 code into julia.
It uses naive regex replacements to do as much as possible,
but the output WILL need further cleanup.
Known conversion problems such as GOTO are commented and marked with FIXME
Most variable declaration lines are entirely deleted, which may or
may not be useful.
; This is a stub make file that downloads the OFF install profile.
core = 7.x
api = 2
projects[drupal][version] = "7.28"
; +++++ Profiles +++++
rafaqz / fix_queue.patch
Created May 23, 2014 11:43
Patches drupal message subscribe module to fix queue
diff --git a/message_subscribe.module b/message_subscribe.module
index da35358..026a2dc 100755
--- a/message_subscribe.module
+++ b/message_subscribe.module
@@ -152,30 +152,26 @@ function message_subscribe_send_message($entity_type, $entity, Message $message,
message_notify_send_message($cloned_message, $options, $notifier_name);
// Check we didn't timeout.
- if ($use_queue && $subscribe_options['queue']['end time'] && time() < $subscribe_options['queue']['end time']) {
- continue 2;
rafaqz / zurb-foundation-extra-layouts.patch
Last active January 11, 2016 13:12
A patch to add extra panels layouts to the drupal zurb-foundation theme
diff --git a/layouts/foundation_2col_stacked_narrow_r/foundation-2col-stacked-narrow-r.tpl.php b/layouts/foundation_2col_stacked_narrow_r/foundation-2col-stacked-narrow-r.tpl.php
new file mode 100644
index 0000000..39eed1e
--- /dev/null
+++ b/layouts/foundation_2col_stacked_narrow_r/foundation-2col-stacked-narrow-r.tpl.php
@@ -0,0 +1,44 @@
+ * @file
+ * Template for a 2 column panel layout.