This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.slf4j.Logger | |
import org.slf4j.LoggerFactory | |
class Ping | |
{ | |
public static Boolean isReachable(String hostname) { | |
Logger logger = LoggerFactory.getLogger('com.example.utils.system.ping') | |
logger.debug("[Ping.isReachable] isReachable called with hostname: {}", hostname) | |
if (! hostname?.trim()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!someString?.trim()) { | |
logger.lifecycle("the string is null or empty.") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Configuration antlrConfiguration = project.getConfigurations().create(ANTLR_CONFIGURATION_NAME) | |
.setVisible(false) | |
.setDescription("The Antlr libraries to be used for this project.") | |
antlrConfiguration.defaultDependencies(new Action<DependencySet>() { | |
@Override | |
public void execute(DependencySet dependencies) { | |
dependencies.add(project.getDependencies().create("antlr:antlr:2.7.7@jar")) | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT first_name, last_name | |
FROM employees | |
WHERE REGEXP_LIKE (first_name, '^Ste(v|ph)en$'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const AWS = require('aws-sdk'); | |
// define our target API as a "service" | |
const svc = new AWS.Service({ | |
// the API base URL | |
endpoint: 'https://www.metaweather.com/api', | |
// don't parse API responses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Write-CertificateToTempFile($uri) { | |
$http = [Net.WebRequest]::Create($uri) | |
try { | |
$resp = $http.GetResponse() | |
$cert = $http.ServicePoint.Certificate | |
$byte = $cert.Export([Security.Cryptography.X509Certificates.X509ContentType]::Cert) | |
} | |
catch { | |
Write-Warning "Errors encoutered during connection attempt:`n$_" | |
Write-Warning "Cannot continue. Quitting." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Exit-WithPause($errlevel) { | |
Write-Host "Press any key to continue..." | |
$anykey = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | |
Exit $errLevel | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Is-Elevated | |
{ | |
$wid = [System.Security.Principal.WindowsIdentity]::GetCurrent() | |
$prp = New-Object System.Security.Principal.WindowsPrincipal($wid) | |
$adm = [System.Security.Principal.WindowsBuiltInRole]::Administrator | |
$IsAdmin = $prp.IsInRole($adm) | |
return $IsAdmin | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Invoke-ShellCommand | |
{ | |
param ( | |
$Command, | |
$Arguments, | |
$WorkingDirectory | |
) | |
$psi = New-object System.Diagnostics.ProcessStartInfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.NOTES | |
Name: Oracle.psm1 | |
Author: Immanuel Smits | |
Version History: | |
1.0 - 7/12/2016 - Initial Release. | |
.SYNOPSIS | |
Module to provide database access to PowerShell | |
.DESCRIPTION | |
Expanded description of what the script does. |
OlderNewer