Skip to content

Instantly share code, notes, and snippets.

View veggiesaurus's full-sized avatar

Angus Comrie veggiesaurus

View GitHub Profile
@veggiesaurus
veggiesaurus / test_s3.ts
Created September 12, 2022 12:00
Benchmarking spectral/spatial profile reads using S3 signed URLs
import DataView from "https://deno.land/x/lodash@4.17.15-es/_DataView.js";
async function getPartialFile(url: string, byteOffset: number = 0, byteLength: number = 4096) {
try {
const headers = new Headers();
headers.append("Range", `bytes=${byteOffset}-${byteOffset+byteLength - 1}`);
const res = await fetch(url, { mode: "no-cors", headers });
return await res.blob();
} catch (err) {
console.log(err);
@veggiesaurus
veggiesaurus / idavie_mapping_schema.json
Created November 8, 2020 19:31
Mapping schema for iDaVIE particles
{
"$schema": "http://json-schema.org/draft-06/schema#",
"definitions": {
"ColorMap": {
"enum": [
"Accent",
"Afmhot",
"Autumn",
"Binary",
"Blues",
@veggiesaurus
veggiesaurus / CMakeLists-imageanalysis.txt
Last active August 13, 2019 09:13
Modified CMake config for building imageanalysis with minimal dependencies
# CASA - Common Astronomy Software Applications
# Copyright (C) 2010 by ESO (in the framework of the ALMA collaboration)
# Copyright (C) 2010-2013 Associated Universities, Inc. Washington DC, USA.
#
# This file is part of CASA.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@veggiesaurus
veggiesaurus / kwin_walie_script.js
Created August 15, 2018 13:14
kwin_walie_script
var screenWidth = 3840;
var screenHeight = 2160;
var taskbarHeight = 68;
var bezelX = 50;
var bezelY = 45;
function geomLeft() {
return { x: 0, y: 0, width: screenWidth, height: 2 * screenHeight - taskbarHeight + bezelY };
}
public render() {
const headerHeight = 25;
const titleClass = this.props.isSelected ? "floating-header selected" : "floating-header";
const widgetConfig = this.props.widgetConfig;
return (
<Rnd
className="floating-widget"
style={{zIndex: this.props.zIndex}}
default={{
// Shift by 5 pixels to compensate for 5px CSS margins
@veggiesaurus
veggiesaurus / CMakeLists.txt
Last active August 2, 2018 14:10
hdf5_rotation
cmake_minimum_required(VERSION 3.0)
project(hdf5_rotate)
set(CMAKE_CXX_STANDARD 11)
FIND_PACKAGE(HDF5)
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR})
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
@veggiesaurus
veggiesaurus / speedtest_suite.sh
Created May 16, 2018 12:24
Speedtest scripts (testing 6 local and 6 international servers)
#!/bin/bash
trap "kill 0" SIGINT
SERVER_NAMES_SA=("Interworks (Cape Town)" "SAIX (Cape Town)" "MTN SA (Cape Town)" "MTN SA (Port Elizabeth)" "Vox Telecom (Johannesburg)" "Seacom (Johannesburg)")
SERVERS_SA=(14749 1270 2962 16107 7254 5889)
SERVER_NAMES_INT=("Vodafone UK (London)" "SEACOM (Amsterdam)" "Orange (Barcelona)" "Cybera (Calgary)" "Comcast (Richmond)" "QTS (Hong Kong)")
SERVERS_INT=(2789 16534 4374 4637 1770 12990)
echo "South African server tests:"
echo "==========================="
@veggiesaurus
veggiesaurus / Chart.bundle.min.js
Created March 23, 2018 15:25
fixed chart.js slow zoom
/*!
* Chart.js
* http://chartjs.org/
* Version: 2.7.2
*
* Copyright 2018 Chart.js Contributors
* Released under the MIT license
* https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Chart=t()}}(function(){return function r(o,s,l){function u(n,t){if(!s[n]){if(!o[n]){var e="function"==typeof require&&require;if(!t&&e)return e(n,!0);if(d)return d(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var a=s[n]={exports:{}};o[n][0].call(a.exports,function(t){var e=o[n][1][t];return u(e||t)},a,a.exports,r,o,s,l)}return s[n].exports}for(var d="function"==typeof require&&require,t=0;t<l.length;t++)u(l[t]);return u}({1:[function(t,e,n){var r=t(5);function i(t){if(t){var e=[0,0,0],n=1,i=t.match(/^#([a-fA-F0-9]{3})$/i
@veggiesaurus
veggiesaurus / viewer.py
Created March 19, 2018 13:21
Python code for loading files from notebook
import IPython
def getViewerURL(file, subdir, cmap, range, imageWidth):
serverUrl = "https://viewer.idia.ac.za?"
if (len(subdir)):
serverUrl += "subdir={}&".format(subdir)
if (len(file)):
serverUrl += "file={}&".format(file)
if (len(cmap)):
serverUrl += "cmap={}&".format(cmap)
@veggiesaurus
veggiesaurus / CMakeLists.txt
Created September 26, 2017 13:10
Dummy CMakeList for CARTA -> CLion editing/debugging
cmake_minimum_required(VERSION 3.0)
project(CartaDummyCmake) # Your project name
set(CMAKE_CXX_STANDARD 11) # This is equal to QMAKE_CXX_FLAGS += -std=c++0x
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC OFF)
# Instruct CMake to run uic automatically when needed.