Skip to content

Instantly share code, notes, and snippets.

View devlead's full-sized avatar

Mattias Karlsson devlead

View GitHub Profile
@devlead
devlead / HelloWorld.s
Created July 31, 2019 08:30
Amiga HelloWorld
ExecBase = 4 ;location of the exec.lib
OpenLib = -552 ;offset to the openLibrary function
OpenLibVersion = 34 ;minimum version to use
CloseLib = -414 ;offset to closeLibrary function
PutString = -948 ;offset to putStr() function
MOVE.L #OpenLibVersion,D0 ;place version of lib in data reg 0
LEA DosName,A1 ;place dos.lib name into add reg 1
MOVE.L ExecBase,A6 ;point to exec.lib's jump table
JSR OpenLib(A6) ;make the jump from exec.lib jump table
TST.L D0 ;check to see if D0 equals zero (fail)
// Switch expression
static string ToLevel(this Verbosity verbosity)
=> verbosity switch
{
Verbosity.Diagnostic => "[****]",
Verbosity.Verbose => "[*** ]",
Verbosity.Normal => "[** ]",
Verbosity.Minimal => "[* ]",
Verbosity.Quiet => "[ ]",
_ => throw new ArgumentOutOfRangeException(message: "invalid enum value",
@devlead
devlead / build.ps1
Last active January 14, 2020 11:42
$CakeVersion = "0.34.1"
if (![string]::IsNullOrWhiteSpace($env:CAKE_VERSION))
{
$CakeVersion = $env:CAKE_VERSION
}
$IsRunningOnUnix = [System.Environment]::OSVersion.Platform -eq [System.PlatformID]::Unix
# Make sure tools folder exists
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
$ToolPath = Join-Path $PSScriptRoot "tools"
if (!(Test-Path $ToolPath)) {
@devlead
devlead / teardown_errorlog.cake
Last active February 10, 2020 18:06
teardown_errorlog.cake
Task("BOOM")
.Does(() => throw new Exception("BOOM"));
Teardown(ctx => {
for(var i = 1; i <= 15; i++)
{
Information("Teardown {0}", i);
}
});
@devlead
devlead / .gitignore
Last active October 5, 2020 06:07
Fluent Tasks
[Tt]ools/
[Aa]rtifacts/
[Oo]bj/
[Bb]in/
.vscode/
@devlead
devlead / taskname.cake
Created November 25, 2020 14:19
Example use task setup/teardown to modify build state
public class BuildData
{
public string TaskName { get; set; }
}
Setup(context => new BuildData());
TaskSetup<BuildData>(
(context, data) => data.TaskName = context.Task.Name
);