Skip to content

Instantly share code, notes, and snippets.

@megamorf
megamorf / Echo-Args.ps1
Created December 13, 2016 15:15
Echo-Args PowerShell
function Echo-Args
{
for($i=0;$i -lt $args.length;$i++)
{
"Arg $i is <$($args[$i])>"
}
}
@megamorf
megamorf / ConvertTo-CrashObject.ps1
Last active December 29, 2017 08:11
PowerShell - Extract crashes from application log events
function ConvertTo-CrashObject
{
<#
.SYNOPSIS
Returns crash objects from an application log event collection
.DESCRIPTION
Returns crash objects from an application log event collection.
Only records where source equals 'Application Error' are processed.
@megamorf
megamorf / Get-TargetedWinEvent.ps1
Last active December 29, 2017 10:33 — forked from jasonadsit/Get-TargetedWinEvent.ps1
Get-TargetedWinEvent.ps1
function Get-TargetedWinEvent
{
<#
.SYNOPSIS
Searches Windows logs for events related to specific Event IDs or EventData.Data values
.DESCRIPTION
Searches Windows logs for events related to specific Event IDs or EventData.Data values
Supports searching offline/exported evt/evtx files as well as online machines
.PARAMETER SearchTerm
@megamorf
megamorf / sample.sh
Created October 16, 2018 16:01
InSpec Shell - show available resource methods
inspec> http("https://www.domain.com/", method: 'GET').class.superclass.instance_methods(false).sort
=> [:body, :headers, :http_method, :status, :to_s]
inspec> file('/tmp').class.superclass.instance_methods(false).sort
=> [:allowed?,
:basename,
:block_device?,
:character_device?,
:contain,
:content,
@megamorf
megamorf / README.txt
Created December 14, 2018 21:24
Selectively disable Liquid variable interpolation
{% raw %}
```yaml
- name: Some action
file:
path: "{{item}}"
```
{% endraw %}
@megamorf
megamorf / README.md
Last active January 4, 2019 23:46
Automation & Testing

web automation

  • Chrome/Firefox extension with workflow editor
  • records actions on the pages you visit, then replays those actions using a simulator
  • data stays on local machine

markdown helpers

@megamorf
megamorf / Dockerfile
Last active November 2, 2024 06:01
APKTOOL Dockerfile
FROM openjdk:8-alpine
RUN apk update && apk --no-cache add curl bash xmlstarlet
VOLUME ["/app"]
WORKDIR /app
ARG APKTOOL_VERSION="2.3.4"
@megamorf
megamorf / flowercare-dashboard.json
Created July 14, 2019 01:06
Flowercare Exporter Blog Post
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}