Skip to content

Instantly share code, notes, and snippets.

@davejlong
davejlong / Set-ScheduledTickets.ps1
Last active Aug 28, 2020
Using the PSAtera module to automatically switch tickets from Pending to Open when the "Scheduled For" field is today.
View Set-ScheduledTickets.ps1
Import-Module PSAtera -MinimumVersion 1.4.0
$Tickets = Get-AteraTicketsFiltered -Pending
foreach($Ticket in $Tickets) {
$ScheduledDate = Get-AteraCustomValue -ObjectType Ticket -ObjectID $Ticket.TicketID -FieldName "Scheduled For"
if ($null -eq $ScheduledDate.ValueAsDateTime) { return }
if ((Get-Date -Date $ScheduledDate.ValueAsDateTime) -le (Get-Date)) {
Set-AteraTicket -TicketID $Ticket.TicketID -TicketStatus "Open"
}
}
@davejlong
davejlong / Add-L2TPVPNConnection.ps1
Created Jul 12, 2019
Creates a new L2TP VPN Connection (written for Atera RMM)
View Add-L2TPVPNConnection.ps1
###
# Author: Dave Long <dlong@cagedata.com>
# Created: 2019-07-12
# Last Modified: 2019-07-12 # Create function
#
# Creates a VPN connection for connecting to an L2TP VPN server
###
function Add-L2TPVpnConnection {
param(
@davejlong
davejlong / brunch-config.js
Created May 25, 2017
Example brunch-config.js to load SimpleMDE into Phoenix
View brunch-config.js
exports.config = {
// See http://brunch.io/#documentation for docs.
files: {
javascripts: {
joinTo: {
"js/app.js": /^(web\/static\/js\/frontend)|(node_modules)/,
"js/admin.js": /^(web\/static\/js\/admin)|(node_modules)/,
"js/ex_admin_common.js": ["web/static/vendor/ex_admin_common.js"],
"js/admin_lte2.js": ["web/static/vendor/admin_lte2.js"],
"js/jquery.min.js": ["web/static/vendor/jquery.min.js"]
@davejlong
davejlong / README.md
Created Mar 17, 2017
Kitto Comment Widget
View README.md

Comment Widget for Kitto

This package includes a widget for displaying comment style text in a dashboard.

Install

  1. Install into your dashboard with mix kitto.install --gist ee402159c3c4770ee06f6e12a220cb35
  2. Create a job to export data with the following format:
@davejlong
davejlong / README.md
Last active Mar 28, 2017
Forecast widget and job for Kitto
View README.md

Forecast Widget and Job Powered By Forecast.io

This package includes a job to pull forecasts from the Forecast.io API and a widget to display the forecast information.

Install

  1. Install into your dashboard with mix kitto.install --gist 229b76b15eae45ee9f5cc1e5d62a40eb
  2. Register for a DarkSky API key and set it into your applications environment in config/config.exs:
View uebersample_router.ex
defmodule Uebersample.Router do
use Plug.Router
plug Ueberauth
alias Ueberauth.Strategy.Helpers
plug :match
plug :dispatch
get "/hello" do
View README.md

JIRA Kitto Plugin

Adds the ability to display lists of issues or a count of issues for filters from JIRA. The plugin is composed of 2 parts:

  • JIRA Job - A Kitto job definition
  • JIRA Table Widget - A Kitto widget for displaying JIRA issues in a table

Installation

  1. Install into your dashboard with mix kitto.install --gist e2adb6e2f301672500d4b13e0a9a7de2
View kitchen.yml
---
driver:
name: docker
provisioner:
name: chef_solo
platforms:
- name: centos-7.2
driver_config:
@davejlong
davejlong / create_locations.exs
Last active Mar 31, 2016
Representing complex associations in Ecto
View create_locations.exs
defmodule TaskRunner.Repo.Migrations.CreateLocations do
use Ecto.Migration
def change do
create table(:locations) do
add :type, :string
end
end
end
@davejlong
davejlong / new.sh
Last active Feb 5, 2016
I just shortened 53 lines of code to 1
View new.sh
DAY=$(date --date="-1 day" +%d)
You can’t perform that action at this time.