This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import traceback | |
class Reward: | |
SLOW_SPEED = 2.5 | |
HIGH_SPEED = 3 | |
WEIGHT_ON_TRACK = 9 | |
WEIGHT_SPEED = 6 | |
WEIGHT_HEADING = 4 | |
WEIGHT_CORRECT_LANE = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Optimizes image file size for all PNG and JPG images in a Microsoft Azure blob storage | |
container by processing them locally and replacing their content with the optimized result. | |
.DESCRIPTION | |
Image files are often needlessly oversized and can be compressed without quality loss using | |
widely-available utilities. Microsoft Azure provides a blob storage service that can be used | |
to host publicly-accessible images for websites or other purposes. For containers with large | |
numbers of suboptimal images or for bulk optimization, this script optimizes all images in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var old = alert; | |
alert = function() { | |
console.log(new Error().stack); | |
old.apply(window, arguments); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @name map-deep-keys | |
/// @group functions | |
/// Find a list of keys buried deep in a nested map | |
@function map-deep-keys($map, $keys...) { | |
@for $i from 1 through length($keys) + 1 { | |
@if $i == length($keys) + 1 { | |
@return map-keys($map); | |
} | |
$key: nth($keys, $i); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Triggers all the methods below it to return a nicely | |
* formatted object. | |
* @param args | |
*/ | |
sanitise(args) { | |
const flatParams = this.flatten(args); | |
const cleanParams = this.clean(flatParams); | |
return this.parseDates(cleanParams); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beforeEach(async(() => { | |
TestBed.configureTestingModule({ | |
imports: [FormsModule, ReactiveFormsModule], | |
declarations: [FormComponent], | |
schemas: [CUSTOM_ELEMENTS_SCHEMA], | |
}) | |
.overrideComponent(FormComponent, { | |
set: { changeDetection: ChangeDetectionStrategy.Default }, | |
}) | |
.compileComponents(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const buildRouteList = ( | |
lowerCasePathname: string, | |
component?: any, | |
inPage = false, | |
) => { | |
const pathName = lowerCasePathname.replace(/-/g, ' '); | |
return { | |
path: pathName, | |
...() => (component ? { component } : undefined), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#%% | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
import numpy as np | |
# from sklearn.linear_model import LinearRegression | |
# from sklearn.linear_model import Ridge | |
# from sklearn.preprocessing import StandardScaler | |
# from sklearn.pipeline import Pipeline | |
# from sklearn.svm import SVC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
rm -rf output.txt | |
for i in $(cat $1); do | |
content="$(curl -I -L "$i")" | |
echo "----------------------" >> output.txt | |
echo "Curl request for $i" >> output.txt | |
echo "$content" >> output.txt | |
echo "----------------------" >> output.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cron = require('node-cron'); | |
const each = require('lodash/each'); | |
/** | |
* Put all schedules in here so they get run through the validator | |
* You may wonder why these have specific names... ideally | |
* we don't ever want jobs to run together as thats | |
* risking putting load on the app unnecessarily | |
*/ | |
const schedules = { |
NewerOlder