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
<?php | |
// ---------------------------------------------------------------------------- | |
$db_insert_rows = 0; | |
$db_update_rows = 0; | |
$db_select_all = "SELECT * FROM $mysql_table"; | |
function db_connect() { | |
global $db_host, $db_user, $db_pass, $db_database; | |
$db_link = mysql_connect($db_host, $db_user, $db_pass) |
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
{ | |
// insert markdown links | |
"Insert Link" : { | |
"prefix": "link", | |
"body": [ | |
"[text][text]{:target=\"_blank\"}" | |
] | |
}, | |
"Insert Reference" : { | |
"prefix": "ref", |
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
#Requires -Version 5.1 | |
#Requires -Module ActiveDirectory | |
$script:ADRootDSE = Get-ADRootDSE | |
class ADDnsNode { | |
# AD Object Properties | |
[String]$Name | |
[String]$CanonicalName |
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
#Requires -Version 5.1 | |
function ConvertTo-ClassDefinition { | |
param( | |
[Parameter(Position = 0, Mandatory, ValueFromPipeline)] | |
[object]$Object, | |
[ValidateNotNullOrEmpty()] | |
[string]$ClassName, |
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 ConvertTo-Celsius { | |
param($Fahrenheit) | |
($Fahrenheit - 32) * 5/9 | |
} | |
function ConvertTo-Fahrenheit { | |
param($Celsius) | |
($Celsius * 9/5) + 32 | |
} |
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 Join-OxfordComma { | |
[CmdletBinding(DefaultParameterSetName='And')] | |
[Alias('jox')] | |
param( | |
[Parameter(Mandatory,ValueFromPipeline)] | |
[string[]]$JoinList, | |
[Parameter(ParameterSetName='And')] | |
[switch]$And, | |
[Parameter(ParameterSetName='Or')] | |
[switch]$Or |
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
#!/usr/bin/env bash | |
set -e # halt script on error | |
echo | |
echo "------------------------------------------------------------------------------------------------------------------------" | |
echo | |
if [ "$TRAVIS_PULL_REQUEST" != "false" -a "$TRAVIS_BRANCH" == "comments" ]; then | |
echo "Building site for pull request for $TRAVIS_BRANCH..." | |
echo |
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 Add-TimeSpan { | |
[CmdLetBinding(DefaultParameterSetName='TimeSpan')] | |
param( | |
[Parameter()] | |
[datetime]$Timestamp = (Get-Date), | |
[Parameter(Mandatory,ParameterSetName='TimeSpan')] | |
[timespan]$TimeSpan, | |
[Parameter(ParameterSetName='TimeSlice')] | |
[int]$Days, | |
[Parameter(ParameterSetName='TimeSlice')] |
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
# ---------------------------------------------------------------------------------------------------------------------- | |
# Functions required to create PowerShell GUI using System.Windows.Forms | |
# ---------------------------------------------------------------------------------------------------------------------- | |
#region load assemblies | |
try { | |
[Void][reflection.assembly]::loadwithpartialname('System.Windows.Forms') | |
[Void][reflection.assembly]::loadwithpartialname('System.Drawing') | |
} | |
catch { |
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 boto3 | |
from mylogger import logger,log_exception | |
def create_session(profile_name='default'): | |
logger.info(f'Creating new boto3 session with profile {profile_name}') | |
try: | |
return boto3.session.Session(profile_name=profile_name) | |
except: | |
raise Exception( log_exception() ) |
NewerOlder