Skip to content

Instantly share code, notes, and snippets.


Rafael Schouten rafaqz

  • Melbourne, Australia
View GitHub Profile
View load_smap.jl
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 Aug 3, 2018
A makefile for pandoc.
View makefile
## 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 Jun 15, 2018
Load a world raster with ArchGDAL and crop australia
View loadraster.jl
using ArchGDAL
function readtiff(file)
img = ArchGDAL.registerdrivers() do do dataset
img ./= maximum(img)
img .= max.(0.0, img)
View Unitfulerrors.jl
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 Oct 20, 2020
Fortran-Julia conversion script
View fortran-julia.jl
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.
View off_stub.make
; 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
Patches drupal message subscribe module to fix queue
View fix_queue.patch
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 Jan 11, 2016
A patch to add extra panels layouts to the drupal zurb-foundation theme
View zurb-foundation-extra-layouts.patch
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.
rafaqz / growshare_feeds_xls_case.patch
Last active Dec 18, 2015
Adds better case handling to feeds xls. Probably should make an issue on
View growshare_feeds_xls_case.patch
diff --git a/ b/
index 3a0e5da..29d66c0 100644
--- a/
+++ b/
@@ -102,7 +102,7 @@ class FeedsExcelParser extends FeedsParser{
$cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set
foreach($cellIterator as $cell){
- $headers[] = trim($cell->getCalculatedValue());
+ $headers[] = trim(drupal_strtolower($cell->getCalculatedValue()));
rafaqz / growshare_feeds.patch
Last active Dec 18, 2015
Drupal Feeds Patch to add location and group handling
View growshare_feeds.patch
diff --git a/plugins/ b/plugins/
index c2b0af5..7bcd238 100755
--- a/plugins/
+++ b/plugins/
@@ -178,6 +178,25 @@ abstract class FeedsProcessor extends FeedsPlugin {
$state = $source->state(FEEDS_PROCESS);
while ($item = $parser_result->shiftItem()) {
+ //hack to get location target id from feed source
+ if ($source->config["FeedsCSVParser"]) {