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
var net = require('net'); | |
HOST = '127.0.0.1' | |
PORT = 12345 | |
LISTENPORT = 23456 | |
var server = net.createServer( function(socket) { | |
socket.on('data', function(data){ | |
console.log('CLIENT:', data); |
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
var net = require('net'); | |
var serverA = net.createServer(); | |
var serverB = net.createServer(); | |
serverA.on('connection', (socketA) => { | |
socketA.on('data', (data) => { | |
console.log('CLIENTA:', data); | |
}); |
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
function concatBuffers() { | |
var totalSize = 0; | |
for( let arg of arguments){ | |
totalSize += arg.byteLength; | |
} | |
var tmp = new Uint8Array( totalSize ); | |
var runningTotalSize = 0; |
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
# No title | |
[System.Windows.Forms.MessageBox]::Show("We are proceeding with next step.") | |
# With title | |
[System.Windows.Forms.MessageBox]::Show("We are proceeding with next step." , "Status") | |
# Yes/No | |
$result = [System.Windows.Forms.MessageBox]::Show('Do you wish to continue', 'Warning', 'YesNo', 'Warning') | |
if ($result -eq 'Yes') { | |
# do something |
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
Get-ChildItem -Filter *.sql | Foreach-Object { | |
$_.Name | |
} |
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
$url = "http://mirror.internode.on.net/pub/test/10meg.test" | |
$output = "10meg.test" | |
(New-Object System.Net.WebClient).DownloadFile($url, $output) |
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
# For Powershell < 4.0 | |
$theHash = ((certutil -hashfile $msodbcsql_Local MD5)[1] -replace '\s','') | |
# Powershell >= 4 have Get-FileHash | |
# https://technet.microsoft.com/en-us/library/dn520872(v=wps.630).aspx |
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
$hshTest | Sort-Object {$_.ServerName} | ForEach-Object {Write-Host `t $_.ServerName `t $_.TimeStamp} |
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
Function GetLocalDBNamedPipe() | |
{ | |
param( [string]$DB) | |
# This function can accept instance names in the format '(localdb)\Instance' | |
$DB = $DB.replace("(localdb)\", '') | |
# Ensure that it is running (assumes the DB already exists) | |
# Note: pipe names change each time the database starts |
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 sqlps | |
Function GetMSSQLBackupFolder | |
{ | |
param([string]$ServerInstance) | |
# taken from https://www.mssqltips.com/sqlservertip/1966/function-to-return-default-sql-server-backup-folder/ | |
$GetBackupFolder = "EXEC master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer',N'BackupDirectory'" | |
return (Invoke-sqlcmd -ServerInstance $ServerInstance -Query $GetBackupFolder).Data |
OlderNewer