Skip to content

Instantly share code, notes, and snippets.

@lansalot
lansalot / AOG.lua
Last active June 19, 2023 18:21
AgOpenGPS Wireshark dissector
-- TODO: dialog box to enter stuff wireshark can't know about (eg lightbar line distance)
AOGProtocol_proto = Proto("AgOpenGPS", "AgOpenGPS Protocol")
RTCMProtocol_proto = Proto("AgOpenGPSRTCM", "AgOpenGPS RTCM Protocol")
local MajorPGNs = {
[0x7F] = "Steer module",
[0xFE] = "From AutoSteer"
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
@lansalot
lansalot / Convert-PGNtoJ1919.ps1
Last active February 12, 2023 22:39
Convert-PGNtoJ1919.ps1
<#
PGNlist.csv like
PGN,Label,InDBC
100,Transmission Control 1,J1939 DBC
200,Electronic Brake System #1/1,No
300,Electronic Brake System #2/1,No
400,External Brake Request,J1939 DBC
x184.trc from canhacker, like:
Time ID DLC Data Comment
rivate void btnSelectShapeFile_Click(object sender, EventArgs e)
{
if (dlgShapefile.ShowDialog(this) == DialogResult.OK)
{
shapeFileName = dlgShapefile.FileName;
if (shapeFileName != null)
{
using (Shapefile shapefile = new Shapefile(shapeFileName))
foreach (Shape shape in shapefile)
@lansalot
lansalot / can-packages-and-tools.md
Created September 5, 2022 22:49 — forked from jackm/can-packages-and-tools.md
Collection of CAN bus packages and tools

Collection of CAN bus packages and tools

This document assumes the use of Linux as the chosen development platform. Items in bold are highly recommended.

It is recommended to use SocketCAN when working with CAN bus on Linux. It is supported by the Linux kernel mainline and follows the Linux interface model, allowing you to use other network tools such as Wireshark. This also allows the creation of virtual CAN interfaces where no physical hardware is required to simulate or replay CAN messages.

[CmdletBinding()]
param (
[Parameter(Mandatory = $true)][String] $ADGroupGUID,
[Parameter(Mandatory = $true)][String] $VHDXLocation
)
If ($ADGroupGUID -NotMatch "S-1-5-") {
Write-Warning "Looks like ADGroupGUID is NOT a GUID - Aborting FSLogic config!!!"
Exit
# adapted from https://gist.github.com/elgrunt0/c53a12838d5b59647d7d47b7f22b4ec8
# Thanks @Grunt !
$CanHash = $true
If (-Not (Get-Command Get-FileHash -ErrorAction SilentlyContinue)) {
$CanHash = $false
}
function Create-CorpEventLog {
param ($logname)
# just in case the scheduled task runs before the NCSI check... we'll wait for an event to turn up. 5 minutes should be enough time to spot a recent reboot
Do {
$ev = get-winevent -filterhashtable @{LogName ="Microsoft-Windows-NCSI/Operational"; StartTime = (get-date).AddMinutes(-5)} -MaxEvents 1 -erroraction SilentlyContinue
Start-Sleep -Seconds 5
} While ($null -eq $ev)
$x = [xml]$ev.toxml()
if (($x.event.eventdata.data| Where {$_.name -eq 'Capability'}).'#text' -eq 0) {
# we have a problem... tell a grown-up
Send-TeamsMessage -Uri "(teams webhook URL)" `
Param ([Switch]$All)
$Users = @()
$Disks = @()
0..4 | % {
$ComputerName = "WVD-PROD-$($_)"
Write-host "Checking $ComputerName"
$qusers = ((quser /server:$ComputerName) -replace '^>', '') -replace '\s{2,}', ',' | ConvertFrom-CSV
$qUsers = $qUsers | Where {$_.username -ne "wvdadmin"} | Select *, ComputerName
$qUsers | % {$_.ComputerName = $ComputerName}
$PoolStatus = Get-AzWvdSessionHost -HostPoolName $HostPool -ResourceGroupName $ResourceGroup
If ((($PoolStatus | Where { $_.Status -ne 'Available' }).Count -gt 1) -or (($PoolStatus | Where { -not $_.AllowNewSession }).Count -gt 1)) {
# OK, more than 1 machine in the pool is either unavailable or not allowing new sessions
$Summary = "Unhealthy WVD pool members"
$InitialDescription = "It appears that not all machines are as they should be. Please investigate"
$InitialDescription += $PoolStatus | Select name , status , lastupdatetime, allownewsession | ft -auto | Out-String
$TeamsID = "https://yourteamswebhooketcetc.webhook.uks.azure-automation.net/webhooks?token=xxxyyy"
Send-TeamsMessage {