Skip to content

Instantly share code, notes, and snippets.

View martijngastkemper's full-sized avatar

Martijn Gastkemper martijngastkemper

View GitHub Profile
#!/bin/bash
#$ -V
#$ -j yes
set NHOSTS manually here:
export NHOSTS=2
NPART=$NHOSTS
#
# This script starts a single-domain Delft3D-FLOW computation on Linux in parallel mode
# asuming nodes are allocated manually
@martijngastkemper
martijngastkemper / csvkit-example.bash
Last active May 26, 2022 07:54
CSVkit example to convert CSV to SQLLite and query the data
# This example requires CSVkit (https://github.com/wireservice/csvkit). A Python toolset with a lot of very cool CSV tools.
# IMPORTANT NOTE: make sure to use a proper csv file. I had a lot of trouble with a csv file created by a service with Dutch
# as locale. Changing it to US solved the problem. Some locales use comma's to seperate point numbers. A semicolon is then
# used.
# Create table example and Load file-a.csv into it
csvsql --db sqlite:///example.db --table example --insert file-a.csv
# Add an extra file to table example
#!/bin/sh
# Install OpenTTD on my RaspberryPi running Buster
## Download and extract
wget https://proxy.binaries.openttd.org/openttd-releases/1.9.2/openttd-1.9.2-source.tar.xz
tar -xf openttd-1.9.2-source.tar.xz
cd openttd-1.9.2
## Install without UI, because it's just a server
#!/bin/sh
# Usage: bash list-ports.sh PRIVATE_PORT
# PRIVATE_PORT default 80
privatePort=${1-80}
services=`docker-compose ps --service --filter "status=running" 2> /dev/null`
if [ -z "$services" ]
then
FROM r-base
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libxml2-dev \
libnetcdf-dev
@martijngastkemper
martijngastkemper / prezi-fullscreen.html
Created October 9, 2015 08:00
Show a fullscreen embed Prezi presentation.
<html>
<head>
<title>Prezi presentation</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.min.css" type="text/css" rel="stylesheet" />
</head>
<body>
<iframe id="iframe_container" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" width="100%" height="100%" src="https://prezi.com/embed/ujk4bs8b72ki/?bgcolor=ffffff&amp;lock_to_path=0&amp;autoplay=0&amp;autohide_ctrls=0&amp;landing_data=bHVZZmNaNDBIWkRDVE93YVVDTVN5dWF2eDNlZVpKayszYlFONi91ZVhLUVdLQ1RaUnZTZ04yVTR0YjM0dXlWbnhYZ3F6WU09&amp;landing_sign=vw8A4a6gflkN-MHQ1jTdQ95uragP8fklEo-qfhXCYwQ"></iframe>
</body>
</html>
@martijngastkemper
martijngastkemper / build-delft3d.sh
Last active February 4, 2017 13:14
Script to build Delft3D with parallel computation Ubuntu Lucid (10.04). I tested it on AWS AMI "Ubuntu Server 14.04 LTS (HVM), SSD Volume Type - ami-f0b11187".
#!/bin/bash
# Sources:
# - http://content.oss.deltares.nl/delft3d/Webinar/Baart_LinuxCodeCompiling/WebinarBaart_11012012_v3.html
# - http://oss.deltares.nl/web/delft3d/general/-/message_boards/view_message/567530
sudo apt-get update
sudo apt-get install \
build-essential\
subversion\
@martijngastkemper
martijngastkemper / edit-multiple-files.bash
Created November 3, 2016 11:56
Edit multiple files with vim
vim `ls /home/*/public_html/.htaccess`
@martijngastkemper
martijngastkemper / replace.sh
Created November 1, 2016 07:41
Replace lines with sed
sed -i-backup "s/RewriteCond \%{HTTP_HOST}.*//" .htaccess
@martijngastkemper
martijngastkemper / acf-custom-rule.php
Last active October 30, 2016 14:12
Create a custom ACF rule to match all pages having a taxonomy enabled.
<?php
// functions.php
add_filter('acf/location/rule_types', 'acf_location_rules_types');
function acf_location_rules_types( $choices ) {
$choices['Post']['post-type-has-taxonomy'] = __('Post Type has Taxonomy');
return $choices;
}
add_filter( 'acf/location/rule_values/post-type-has-taxonomy', 'acf_location_rules_values_has_taxonomy' );
function acf_location_rules_values_has_taxonomy( $choices ) {