Skip to content

Instantly share code, notes, and snippets.

View cmaggiulli's full-sized avatar

Chris Maggiulli cmaggiulli

View GitHub Profile
@cmaggiulli
cmaggiulli / deploymentAPICall.groovy
Created April 14, 2017 11:54
New Relic deployment API for Jenkins build
@Grapes([
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7')
])
import groovyx.net.http.*
def API_KEY = "000000000000000000000000"
def APP_ID = "1111111"
def URL = "https://api.newrelic.com/v2/applications/${APP_ID}/deployments.json"
@cmaggiulli
cmaggiulli / impersonate.groovy
Created May 4, 2017 06:36
Impersonate User script to run in Liferay 6.2 Script Console
import com.liferay.portal.util.PortalUtil;
import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.util.Encryptor;
import javax.servlet.http.HttpServletRequest;
String key = "23410447";
String uid = "";
ThemeDisplay themeDisplay = null;
HttpServletRequest request = null;
@cmaggiulli
cmaggiulli / AlgebraicNotationPoint2D
Created June 28, 2017 05:36
AlgebraicNotationPoint2D is an extension of javafx.geometry.Point2D for a chess game. Notably it creates a new constructor with a char, double signature for standard algebraic piece notation in chess. It contains a private static converter method which turns the char into a double value representing it's alphabetical index starting at 1. The cha…
package io.github.cmaggiulli.Game;
import javafx.geometry.Point2D;
public class AlgebraicNotationPoint2D extends Point2D {
public AlgebraicNotationPoint2D(char rank, double file) {
super(alphabeticalIndex(rank), file);
}
@cmaggiulli
cmaggiulli / eclipse.exe.manifest
Created July 31, 2017 13:34
HiDPI Eclipse configuration
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0" processorArchitecture="*"
@cmaggiulli
cmaggiulli / MultiTechMonitor.ps1
Created August 3, 2017 15:25
This powershell script runs hourly via task scheduler and checks the number of MuliTech modems currently running against the amount that was running the last hour. If a diff exists send email to recipients. I wrote this script to monitor our outgoing fax server since RabbitMQ would not reflect a backup of faxes after handing off the message
function Send-ComPort-Alert
{
param([bool]$Asc, [string]$Modems)
# Sender and Receiver
$From = "sender@example.com"
$To = "you@example.com", "me@example.com"
# Server and Port
$Server = "smtp.server.com"
@cmaggiulli
cmaggiulli / aws-config-linux.sh
Created November 7, 2017 15:32
AWS Key setup for CLI and Programmatic use on Linux
#!/bin/bash
# To run this use the following commands
# ----------------------------------
# sudo chmod +x aws-config-linux.sh
# sudo . aws-config-linux.sh access_key_id secret_access_key
fldr=~/.aws
cred=$fldr/credentials
@cmaggiulli
cmaggiulli / aws-config-windows.ps1
Created November 7, 2017 15:33
AWS Key Setup for Windows CLI and Programmatic use
$access_key_id = $args[0]
$secret_access_key = $args[1]
$dir = Join-Path $env:userprofile "\.aws\"
$file = Join-Path $dir "credentials"
if (-NOT (Test-Path $dir)) {
New-Item $dir -type Directory
}
if (-NOT (Test-Path $file)) {
@cmaggiulli
cmaggiulli / OIC-DBaaS-SE-Template.yaml
Last active August 5, 2018 20:59
A YAML template for provisioning an Oracle Cloud stack containing an enterprise IC instance (Customer Managed), a standard 12c database, and associated storage containers. This differs from the template provided by Oracle Cloud to provision which only provides an option to use Oracle 12c Database as a Service Enterprise Edition. Although the OIC…
---
template:
templateName: OIC-DBaaS-SE-Template.yaml
templateVersion: 1.1.0
templateDescription: Integration Cloud template with Oracle 12c Database as a Service Standard Edition
#----------------------------------------
# PARAMETERS
#----------------------------------------
parameters:
@cmaggiulli
cmaggiulli / deactivate.groovy
Last active June 15, 2018 21:44
A Groovy script to facility mass deactivating of process applications in Oracle Integration Cloud. The script can be used to deactivate all revisions of a given project. Please see header comments for usage instructions. Please do not use on production environment, as deactivating an application will truncate all the runtime data associated with…
#!/usr/bin/env groovy
/*
* This script undeploys all revisions of a particular project as specified in the command line arguments
* Example execution command below
* groovy deactivate.groovy https://My-Oracle-URL.com MyProject MyUsername MyPassword
* Author: Chris Maggiulli
* Email: cmaggiulli@gmail.com
*/
@cmaggiulli
cmaggiulli / get-information.ps1
Created June 17, 2018 22:24
A PowerShell script I use to retrieve the IP address of a user (see: family member) I'm attempting to assist with a remote viewing tool.
$ip=get-WmiObject Win32_NetworkAdapterConfiguration|Where {$_.Ipaddress.length -gt 1}
$EmailTo = "postmaster@yourdomain.com"
$EmailFrom = "DoNotReply@example.comm"
$Subject = "$($ip.ipaddress[0])"
$Body = "$($ip.ipaddress[0])"
$SMTPServer = "smtp.example.com"
$SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body)
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true