Skip to content

Instantly share code, notes, and snippets.

@alastairtree
alastairtree / PacketSplitter.py
Last active January 11, 2024 10:27
This scripts takes a binary file containing CCSDS packets and splits them into one file per packet. Assumes CCSDS packets always have a secondary header, and that the first 4 bytes of data are a SCLK timestamp in seconds with 2010-01-01 as epoch as per the NASA IMAP Mission spec.
#!/usr/bin/python
# This scripts takes a binary file containing CCSDS packets and splits them into one file per packet
# Usage > python3 PacketSplitter.py -i <InputFile> -o <outputFiles>
import datetime
import sys, getopt, os
from os.path import exists
choco install authy-desktop -y
choco install git –y
choco install putty -y
choco install gitextensions -y
choco install vscode –y
choco install 7zip –y
choco install googlechrome -y
choco install firefox –y
choco install powershell –y
choco install powershell-core -y
@alastairtree
alastairtree / RoutingLinkBuilder.cs
Created February 22, 2021 01:05
MVC Route aware ILinkBuilder for JsonApiDotNet 4 & aspnet core 3.1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Controllers;
using JsonApiDotNetCore.Middleware;
using JsonApiDotNetCore.Queries;
using JsonApiDotNetCore.Queries.Expressions;
using JsonApiDotNetCore.Queries.Internal.Parsing;
@alastairtree
alastairtree / HttpCorrelation.cs
Created December 30, 2020 08:46
Using stevejgordon/CorrelationId inside Azure Functions
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CorrelationId;
using CorrelationId.Abstractions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
@alastairtree
alastairtree / run-tests.ps1
Created June 28, 2020 00:34
Quick integration tests of terraform modules using powershell
Function TC-Escape ([string] $text){
return $text.Replace("|","||").Replace("'","|'").Replace("\n","|n").Replace("\r","|r").Replace("[","|[").Replace("]","|}")
}
Function Invoke-Exec
{
[CmdletBinding()] param([Parameter(Position=0,Mandatory=1)][scriptblock]$cmd)
$scriptExpanded = $ExecutionContext.InvokeCommand.ExpandString($cmd).Trim()
# Original code from https://github.com/slavizh/OMSSearch/blob/master/OMSSearch.psm1
# - Updated/fixed authentication method calls
# - Ensure ADAL DLL is loaded
Function Get-AADToken {
<#
.SYNOPSIS
Get token from Azure AD so you can use the other cmdlets.
.DESCRIPTION
Get token from Azure AD so you can use the other cmdlets.
choco install sql-server-management-studio –y
choco install git –y
choco install putty -y
choco install gitextensions -y
choco install vscode –y
choco install azure-data-studio –y
choco install 7zip –y
choco install nodejs-lts -y
choco install googlechrome -y
choco install firefox –y
@alastairtree
alastairtree / build.ps1
Created February 27, 2018 22:56
AppVeyor dotnet core CLI build script - restore, compile, test, upload test results and publish artifacts/nupkgs
Set-StrictMode -Version latest
$ErrorActionPreference = "Stop"
# Taken from psake https://github.com/psake/psake
<#
.SYNOPSIS
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
to see if an error occcured. If an error is detected then an exception is thrown.
This function allows you to run command-line programs without having to
explicitly check the $lastexitcode variable.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Util
{
public class FileHelper
{
public bool IsDirectoryEmpty(string path)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Util
{
public class FileHelper
{
public bool IsDirectoryEmpty(string path)