Skip to content

Instantly share code, notes, and snippets.

@rezarahimian
rezarahimian / Codes.sol
Last active August 11, 2019 17:59
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.2+commit.1df8f40c.js&optimize=true&gist=
pragma solidity ^0.5.0;
[CmdletBinding()]
PARAM()
# Returns IP address of a network adapter
function Get-IPInfo()
{
[CmdletBinding()]
PARAM(
[Parameter(Mandatory=$True)]
[ValidateSet('IPv4','IPv6','IPv6LinkLocal')]
[CmdletBinding()]
PARAM()
# Returns IP address of a network adapter
function Get-IPInfo()
{
[CmdletBinding()]
PARAM(
[Parameter(Mandatory=$True)]
[ValidateSet('IPv4','IPv6','IPv6LinkLocal')]
[CmdletBinding()]
Param()
$VMPath = "D:\VMs"
$VMName = "ClearOS"
$VHDPath = Join-Path -Path $VMPath -ChildPath "$VMName\Virtual Hard Disks\$VMName.VHDX"
$ISOPath = "I:\ISO\ClearOS-DVD-x86_64.iso"
# Creating new 20GB fixed VHDX.
New-VHD -Path $VHDPath -SizeBytes 20GB -Fixed -Verbose
#!/bin/bash
# Source networking configuration.
. /etc/clearos/network.conf
# Bail if not ipv4
if [ "$FW_PROTO" != 'ipv4' ]; then
return 0
fi
[CmdletBinding()]
PARAM(
[Parameter(Mandatory=$true)][String] $CredentialPath,
[Parameter(Mandatory=$true)][String] $Scope
)
try
{
$Toekn = $null
[CmdletBinding()]
PARAM(
[Parameter(Mandatory=$true)][String] $CredentialPath,
[Parameter(Mandatory=$true)][String] $Resource
)
try
{
$Token = $null
function Get-SCCMData
{
[CmdletBinding()]
PARAM(
[Parameter(Mandatory=$true)][ValidateSet('AllDevices','HWModel')][String] $QueryName,
[Parameter(Mandatory=$true)][String] $CredentialPath,
[Parameter(Mandatory=$false)][String] $SQLInstance = 'MSSQLSERVER\SQL_PRD',
[Parameter(Mandatory=$false)][String] $DBName = 'SCCM_DB_PRD',
[Parameter(Mandatory=$false)][String[]] $QueryParam
)
#Exporting PSCredential to XML
$Password = ConvertTo-SecureString 'XXX' -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential('svc_prd', $Password)
$Credential | Export-Clixml -Path 'C:\PS\Cred.xml'
#Importing PSCredential from XML
#$Credential = [System.Management.Automation.PSCredential](Import-Clixml -Path 'C:\PS\Cred.xml')
#Converting password to PlainText (e.g., API Payload)
#$Password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Credential.Password))
$Providers = [System.Runtime.InteropServices.Marshal]::BindToMoniker("ADs:")
ForEach ($Provider in $Providers)
{
$Provider.GetType().InvokeMember("Name", "GetProperty", $null, $Provider, $null)
}