Skip to content

Instantly share code, notes, and snippets.

View SiccarPoint's full-sized avatar

Dan Hobley SiccarPoint

View GitHub Profile
@SiccarPoint
SiccarPoint / cmake_xcode_workaround.sh
Created June 2, 2020 09:09
This is a schematic script to enable cmake compilation with late versions of Xcode on a Mac
# This is a schematic script to enable cmake compilation with late versions of Xcode on a Mac
# This is the first problem: https://www.anaconda.com/blog/utilizing-the-new-compilers-in-anaconda-distribution-5
# Other routes may be possible...
# We appear to need libomp and llvm alongside cmake, so
brew install cmake libomp llvm
# 1. Grab MacOSX10.9.sdk from https://github.com/phracker/MacOSX-SDKs and stick it in /opt/MacOSX10.9.sdk
# 2. Point the cmake compiler at this SDK
@SiccarPoint
SiccarPoint / fix_html_xml.sh
Last active October 12, 2022 09:09
Clean up an imported reference xml in Zotero that contains bad html tags from e.g. Papers3 export
# Guaranteed for mac only due to syntax of sed function, but changes for
# other OS should be minor.
# Ensure you have sqlite3 on your machine.
# Remember to set unix permissions on this file before running:
# chmod 755 fix_html_xml.sh
# and run:
# ./fix_html_xml.sh
# This script should run clean! If you see errors, it won't have worked.
# Will probably take a while to run (mins)
@SiccarPoint
SiccarPoint / assign_to_issue.py
Last active June 19, 2019 16:40
Modify github issue assignees through API
import requests
r = requests.get(
"https://api.github.com/search/issues",
params={
"q": "fish+repo:SiccarPoint/stochastic-delta"
} # find the I am a fish issue
)
fishhue = r.json()
issue_url = fisshue['items'][0]['url'] # 0 index as only one issue has fish in it
This file has been truncated, but you can view the full file.
2016-10-06 16:53:23 +0100
make
GDAL_DYNAMIC=
mkdir -p /private/tmp/grass-70-20161006-33138-1wldk1d/grass-7.0.4/dist.x86_64-apple-darwin15.6.0
mkdir -p /private/tmp/grass-70-20161006-33138-1wldk1d/grass-7.0.4/bin.x86_64-apple-darwin15.6.0
mkdir -p /private/tmp/grass-70-20161006-33138-1wldk1d/grass-7.0.4/dist.x86_64-apple-darwin15.6.0/include/grass
mkdir -p /private/tmp/grass-70-20161006-33138-1wldk1d/grass-7.0.4/dist.x86_64-apple-darwin15.6.0/lib
mkdir -p /private/tmp/grass-70-20161006-33138-1wldk1d/grass-7.0.4/dist.x86_64-apple-darwin15.6.0/bin
@SiccarPoint
SiccarPoint / component_signatures.py
Created December 2, 2015 00:23
This shows the different ways one could have a component "time" parameter work
# #1: As a "run until" style:
# approach seems fiddly and annoying to me, but has advantage of always being general:
time_elapsed = 0.
dt = 5. # or whatever
while elapsed_time < total_time:
new_time = elapsed_time + dt
if new_time > total_time:
new_time = total_time - elapsed_time
my_component.run_component(new_time, *args, **kwds)
for (interval_duration, rainfall_rate) in precip.yield_storm_interstorm_duration_intensity():
if rainfall_rate != 0.:
mg = fr.route_flow(grid=mg, runoff_rate=rainfall_rate)
#print 'Area: ', numpy.max(mg.at_node['drainage_area'])
mg,_,_ = sp.erode(mg, interval_duration, Q_if_used='water_discharges', K_if_used='K_values')
#add uplift
mg.at_node['topographic_elevation'][mg.core_nodes] += uplift*interval_duration
this_trunc = precip.elapsed_time//out_interval
if this_trunc != last_trunc: #a new loop round
print 'made it to loop ', out_interval*this_trunc