This file contains hidden or 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
# Redis Cheatsheet | |
# All the commands you need to know | |
redis-server /path/redis.conf # start redis with the related configuration file | |
redis-cli # opens a redis prompt | |
# Strings. |
This file contains hidden or 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
#Installs SQL Server locally with standard settings for Developers/Testers. | |
# Install SQL from command line help - https://msdn.microsoft.com/en-us/library/ms144259.aspx | |
$sw = [Diagnostics.Stopwatch]::StartNew() | |
$currentUserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name; | |
$SqlServerIsoImagePath = "???\Downloads\Microsoft\SQL Server 2016 Developer Edition\en_sql_server_2016_developer_x64_dvd_8777069.iso" | |
#Mount the installation media, and change to the mounted Drive. | |
$mountVolume = Mount-DiskImage -ImagePath $SqlServerIsoImagePath -PassThru | |
$driveLetter = ($mountVolume | Get-Volume).DriveLetter | |
$drivePath = $driveLetter + ":" |
This file contains hidden or 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
#Set Environment Variables for Azure RM Terraform | |
$ENV:ARM_SUBSCRIPTION_ID = "" | |
$ENV:ARM_CLIENT_ID = "" | |
$ENV:ARM_CLIENT_SECRET = "" # This should end with an '=' symbol | |
$ENV:ARM_TENANT_ID = "" |
This file contains hidden or 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
# Conversion of http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTsearch#search.2Fjobs.2Fexport | |
# example using curl, to PowerShell with Invoke-RestMethod cmdlet | |
# | |
# $ curl -k -u admin:changeme https://localhost:8089/services/search/jobs/export | |
# --data-urlencode search="search index=_internal | stats count by sourcetype" | |
# -d output_mode=json -d earliest="rt-5m" -d latest="rt" | |
$cred = Get-Credential | |
# This will allow for self-signed SSL certs to work |
This file contains hidden or 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
$Username ="azure_*********@azure.com" | |
$Password = ConvertTo-SecureString "********" -AsPlainText -Force | |
$credential = New-Object System.Management.Automation.PSCredential $Username, $Password | |
$SMTPServer = "smtp.sendgrid.net" | |
$EmailFrom = "[email protected]" | |
$EmailTo = "[email protected]" | |
$Subject = "SendGrid test" | |
$Body = "SendGrid testing successful" | |
Send-MailMessage -smtpServer $SMTPServer -Credential $credential -Usessl -Port 587 -from $EmailFrom -to $EmailTo -subject $Subject -Body $Body |
This file contains hidden or 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-Module "PATH_TO_Microsoft.ServiceBus.dll" | |
#Create the required credentials | |
$tokenProvider = [Microsoft.ServiceBus.TokenProvider]::CreateSharedSecretTokenProvider("owner", "YOUR_ISSUERSECRET") | |
$namespaceUri = [Microsoft.ServiceBus.ServiceBusEnvironment]::CreateServiceUri("sb", "YOUR_NAMESPACE", ""); | |
$namespaceManager = New-Object Microsoft.ServiceBus.NamespaceManager $namespaceUri,$tokenProvider | |
#Create a queue | |
$queue = $namespaceManager.CreateQueue("MyPowershellQueue"); |
This file contains hidden or 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
# Step 1 - Exporting SecureString from Plain text | |
"P@ssword1" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "C:\Temp 2\Password.txt" | |
# Step 2 - Creating PSCredential object | |
$User = "MyUserName" | |
$File = "C:\Temp 2\Password.txt" | |
$MyCredential=New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, (Get-Content $File | ConvertTo-SecureString) | |
# The Default Execution Policy is set to restricted, you can see it by typing: | |
Get-ExecutionPolicy |
This file contains hidden or 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
// sloppy traceroute clone | |
// inpired by https://blogs.oracle.com/ksplice/entry/learning_by_doing_writing_your | |
// and made possible by https://www.npmjs.org/package/raw-socket | |
var raw = require('raw-socket'); | |
var dns = require('dns'); | |
var target = process.argv[2] || '173.230.146.29'; | |
var MAX_HOPS = 64; | |
var TIME_LIMIT = 5000; |
This file contains hidden or 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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
DemoPing(); | |
//DemoTraceRoute(); | |
//DemoPortScan(); | |
//DemoWhois(); | |
Console.WriteLine(); |
This file contains hidden or 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'; | |
// Nodemailer: v2.0.0 | |
// Ubuntu: 14.04 | |
// node: v5.5.0 | |
// npm: 3.3.12 | |
var nodemailer = require('nodemailer'); | |
var transporter = nodemailer.createTransport({ | |
service: 'Mandrill', |