Skip to content

Instantly share code, notes, and snippets.

Mattias Karlsson devlead

Block or report user

Report or block devlead

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@devlead
devlead / HelloWorld.s
Created Jul 31, 2019
Amiga HelloWorld
View HelloWorld.s
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)
@devlead
devlead / Async.cake
Created Jul 9, 2017
Sample of using async await in a cake script using a AsyncHelper class to work with all async scenarios, currently needs "--Experimental" flag or to use the Cake.CoreCLR runner as a newer version of Roslyn is required for async to be recognized. Example invocation: cake .\AsyncHelper.cake -Experimental
View Async.cake
#load "AsyncHelper.cake"
#r "System.Net.Http"
using System.Net.Http;
using System.Net.Http.Headers;
string url = "https://icanhazdadjoke.com/";
var result = AsyncHelpers.RunSync(
async ()=> {
using(var client = new HttpClient())
@devlead
devlead / csc.cake
Created May 18, 2017
Example utilize csc.exe from cake
View csc.cake
DirectoryPath projectPath = MakeAbsolute(Directory("./cscTest"));
DirectoryPath outputPath = projectPath.Combine("bin/Debug");
FilePath asssemblyPath = outputPath.CombineWithFilePath("Test.dll"),
symbolsPath = outputPath.CombineWithFilePath("Test.pdb");
FilePath[] references = new FilePath[0]; // add any assembly dependencies
Task("Clean")
.Does(() => {
@devlead
devlead / DynamicTest.csproj
Last active Apr 27, 2017
Example .NET Core app create objects from type name
View DynamicTest.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
</ItemGroup>
@devlead
devlead / a.cake
Created Nov 2, 2016
Sample Cake Inject Task dependency
View a.cake
var taskA = Task("A")
.Does(()=>Information("Hello from A"));
@devlead
devlead / build.cake
Created Oct 31, 2016
Example of a custom Cake tool utilizing the in Cake built on tool classes, settings and tool resolution
View build.cake
#load "./customtool.cake"
#load "./mytools.cake"
GitStatus();
GitBranch(new CustomToolSettings { ToolPath = "/bin/git.exe" });
@devlead
devlead / keybase.md
Last active Apr 11, 2016
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am devlead on github.
  • I am devlead (https://keybase.io/devlead) on keybase.
  • I have a public key whose fingerprint is 477F E77B F054 8C1F C0CE A7F1 F678 07BF C550 2BA9

To claim this, I am signing this object:

@devlead
devlead / git-random-tip.ps1
Last active Nov 9, 2015
PowerShell scrips that displays random GIT tips
View git-random-tip.ps1
(irm https://raw.githubusercontent.com/git-tips/tips/master/tips.json)|sort {random}|select -First 1|% {"$($_.title)`r`n$($_.tip)" }
@devlead
devlead / parsegitlog.ps1
Created Oct 29, 2015
Example working with git log in PowerShell
View parsegitlog.ps1
# Get last 100 log entries as a PowerShell object
$gitHist = (git log --format="%ai`t%H`t%an`t%ae`t%s" -n 100) | ConvertFrom-Csv -Delimiter "`t" -Header ("Date","CommitId","Author","Email","Subject")
# Now you can do iterate over each commit in PowerShell, group sort etc.
# Example to get a commit top list
$gitHist|Group-Object -Property Author -NoElement|Sort-Object -Property Count -Descending
# Example do something for each commit
$gitHist|% {if ($_.Author -eq "Mattias Karlsson") {"Me"} else {"Someone else"} }
@devlead
devlead / azure.xml
Created Oct 17, 2015
Add new file types under system.webserver
View azure.xml
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
You can’t perform that action at this time.