Skip to content

Instantly share code, notes, and snippets.

View rjattrill's full-sized avatar

Ross Attrill rjattrill

View GitHub Profile
@rjattrill
rjattrill / autogluon_forecast.py
Created December 23, 2022 04:32
Issue with excluded_model_types with AutoGluon
import pandas as pd
from autogluon.timeseries import TimeSeriesPredictor, TimeSeriesDataFrame
# Load the data into a TimeSeriesDataFrame
df = pd.read_csv(
"m4_hourly.csv",
parse_dates=["Date"],
)
ts_dataframe = TimeSeriesDataFrame.from_data_frame(
We can't make this file beautiful and searchable because it's too large.
M4id,Date,Value
H1,2015-01-07 12:00:00,605.0
H1,2015-01-07 13:00:00,586.0
H1,2015-01-07 14:00:00,586.0
H1,2015-01-07 15:00:00,559.0
H1,2015-01-07 16:00:00,511.0
H1,2015-01-07 17:00:00,443.0
H1,2015-01-07 18:00:00,422.0
H1,2015-01-07 19:00:00,395.0
H1,2015-01-07 20:00:00,382.0
@rjattrill
rjattrill / ReceiveYamlSinatra.rb
Last active December 16, 2020 19:04
Receive YAML file in Sinatra
post '/import' do
contents = request.body.read
# Remove wrappers from the client FormData wrapper
yaml = contents.gsub(/^------WebKitFormBoundary.*\n|^Content-Disposition.*\n|^Content-Type.*\n/, '')
puts "YAML: #{yaml}"
end
# See also: https://gist.github.com/rjattrill/dd2d2597d4993433bcc6de7792a3a903 for a React/JavaScript sender.
@rjattrill
rjattrill / SendYamlFromJavascript.js
Last active December 16, 2020 19:04
Sending YAML document from JavaScript (React)
import * as React from 'react'
function PickYamlFile() {
onInputChange = async (evt) => {
const file = evt.currentTarget.files[0]
const url = myHost() + '/import'
// Important to wrap the YAML with FormData encoding as YAML may contain % or other difficult characters.
const data = new FormData()
@rjattrill
rjattrill / NonAlcholicDrinking.md
Last active December 6, 2015 10:18
Guidelines to Support Non Alcoholic Drinking

Overview

Drinking alcohol is a big part of Australian culture. However, not everybody wants to drink alcohol all the time when socializing. This paper provides some guidelines to support people who want to drink non alcholic beverages when socializing.

Catering

It is surprisingly common at community, work or social events that people responsible for catering provide no non alcholic drink options. This can be particularly awkward if a tap is not readily available in the socialising area (as can happen outdoors,

@rjattrill
rjattrill / ruby-build-w-rake.json
Last active November 30, 2015 04:59
Ruby Build configuration for Rake w. Jruby
{
"cmd": "jruby",
"name": "rake test",
"args": [ "-S", "bundle", "exec", "rake", "test", "TEST=\"{FILE_ACTIVE}\""],
"sh": false,
"cwd": "{PROJECT_PATH}"
}
@rjattrill
rjattrill / actors_overview.md
Created October 1, 2015 02:30
An overview of the Actors programming model

Keybase proof

I hereby claim:

  • I am rjattrill on github.
  • I am rjattrill (https://keybase.io/rjattrill) on keybase.
  • I have a public key whose fingerprint is A924 38A3 1EC5 C8FF 63F3 D2A7 5F64 4A6A D472 EB84

To claim this, I am signing this object:

@rjattrill
rjattrill / DynamicMethodInvocation.as
Created December 6, 2013 03:31
Call a method or access a property dynamically in ActionScript given a string matching the method name or property
public function checkFunc() : void {
Alert.show("inside function");
}
public var myfunc:String = "checkFunc";
public var newFunc:Function = this[myfunc];
newFunc(); // This will invoke checkFunc
@rjattrill
rjattrill / DBIxDataModelWhereIn.pl
Created December 5, 2013 02:50
IN clause with DBIx::DataModel or SQL::Abstract
-where => {
employee_code => {-in => [qw(CA CT CX)]}
},