Skip to content

Instantly share code, notes, and snippets.

@jdcockrill
jdcockrill / marked.directive.ts
Created April 26, 2018 12:49
Angular 5 directive which converts the contents of the labelled element from Markdown to HTML
import { Directive, ElementRef, OnInit, Renderer2 } from '@angular/core';
import * as marked from 'marked';
/**
* Use the `marked` JS library (https://github.com/markedjs/marked) to convert the contents
* of the decorated element from Markdown into HTML.
* Install marked into your Angular project to make it available - `npm install --save marked`
* create an element in your component.html and write some Markdown in it! E.g:
* ```
* <div appMarked>
@jdcockrill
jdcockrill / get-spotlight.ps1
Last active April 7, 2018 17:21
Copy Windows Spotlight images out of their cached directory so you can use them for something else, such as Desktop themes!
Param(
[Parameter(Mandatory = $True)]
[ValidateScript({Test-Path $_ -PathType 'Container'})]
[string]
$out,
[Parameter(Mandatory = $False)]
[switch]
$KeepDesktopWallpaper,
[Parameter(Mandatory = $False)]
[switch]

Keybase proof

I hereby claim:

  • I am jdcockrill on github.
  • I am jdcockrill (https://keybase.io/jdcockrill) on keybase.
  • I have a public key ASBb5mP39i50JJwtEtxxXFQb7dYhEgW2cEpeAfKl_p661go

To claim this, I am signing this object:

@jdcockrill
jdcockrill / 41-azure_eventhub.conf
Created June 2, 2017 20:33
rsyslog output plugin for Azure Event Hubs using nodejs+amqp10
module(load="omprog")
action(type="omprog"
binary="/pathto/az_eventhub.js"
template="RSYSLOG_TraditionalFileFormat")
@jdcockrill
jdcockrill / az_function.js
Created May 29, 2017 20:34
Processing syslog with Azure Function App
/**
* A very rough example of processing the syslog messages received in
* https://gist.github.com/jdcockrill/d9ca6c10ebaab26ade776ee1f19346d7
* Messages are assumed to be unix syslog. They are parsed with a regex
* (which doesn't always work) and written to Azure Blob Storage.
* If the regex matches, then the parsed output is written to Blob.
* If it doesn't match, then just the raw message is written.
**/
var regex = /(\d+\.\d+\.\d+\.\d+) : <(\d+)>(\w+\s+\d+\s+\d+:\d+:\d+) (\w+) (\w+)(-|\[)(\d+)\]*: (.*)/g;
@jdcockrill
jdcockrill / syslog_to_aqs.py
Last active May 29, 2017 20:45 — forked from marcelom/pysyslog.py
Tiny Python Syslog Server that sends to Azure Queue Service
#!/usr/bin/env python
## based on https://gist.github.com/marcelom/4218010
## Tiny Syslog Server in Python that writes to Azure Queue Service
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and write to Azure Queue Service
## Some folks might want to split the ACCOUNT_NAME, ACCOUNT_KEY and QUEUE
## variables out as command-line args.