Skip to content

Instantly share code, notes, and snippets.

@megamorf
megamorf / flowercare-dashboard.json
Created Jul 14, 2019
Flowercare Exporter Blog Post
View flowercare-dashboard.json
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
@megamorf
megamorf / Dockerfile
Last active Jan 24, 2019
APKTOOL Dockerfile
View 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 / README.md
Last active Jan 4, 2019
Automation & Testing
View README.md

web automation

https://wildfire.ai/

  • 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 / README.txt
Created Dec 14, 2018
Selectively disable Liquid variable interpolation
View README.txt
{% raw %}
```yaml
- name: Some action
file:
path: "{{item}}"
```
{% endraw %}
@megamorf
megamorf / sample.sh
Created Oct 16, 2018
InSpec Shell - show available resource methods
View sample.sh
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,
View 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 / ConvertTo-CrashObject.ps1
Last active Dec 29, 2017
PowerShell - Extract crashes from application log events
View ConvertTo-CrashObject.ps1
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 / Echo-Args.ps1
Created Dec 13, 2016
Echo-Args PowerShell
View Echo-Args.ps1
function Echo-Args
{
for($i=0;$i -lt $args.length;$i++)
{
"Arg $i is <$($args[$i])>"
}
}
View Access API with OAuth 2.0 Access Token.ps1
$headers = @{}
$headers.Add('Authorization', "Bearer $accesstoken")
Invoke-RestMethod -Headers $headers -Uri https://graph.microsoft.com/v1.0/me -Method Get
@megamorf
megamorf / TrustAllCertsPolicy.ps1
Created Sep 23, 2016
PowerShell - Ignore SSL errors
View TrustAllCertsPolicy.ps1
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
You can’t perform that action at this time.