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
const findLongestEvenWord = sentence => { | |
let array = sentence.split(/\s+/); | |
return array.filter(x => x.length % 2 === 0).sort((a , b) => b.length - a.length )[0]; | |
} | |
console.log(findLongestEvenWord("The code is self explanatory , I have used the put method")); | |
console.log(findLongestEvenWord("Once created , you can click on Test and send a JSON as below")); |
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
# CodeDeploy powershell template | |
# Are you running in 32-bit mode? | |
# (\SysWOW64\ = 32-bit mode) | |
if ($PSHOME -like "*SysWOW64*") | |
{ | |
Write-Warning "Restarting this script under 64-bit Windows PowerShell." |
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
using System; | |
using System.Data; | |
using System.Data.Entity; | |
using System.Data.Entity.Infrastructure; | |
using System.Linq; | |
public class GenericRepository<T> : IRepository<T>, IDisposable where T : class | |
{ | |
public GenericRepository(IDbContext context) | |
{ |
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
var cts = new CancellationTokenSource(); | |
var token = cts.Token; | |
Task.Factory.StartNew(() => | |
{ | |
while (true) | |
{ | |
if (cts.IsCancellationRequested) | |
{ | |
return; |
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 | |
ec2 = boto3.resource('ec2') | |
print('Loading function') | |
def lambda_handler(event, context): | |
instance = list_autostop_instance() | |
stop_instances(instance) | |
def find_name(instance): |
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 shortcode to find latest TechNet download site | |
$confirmationPage = 'http://www.microsoft.com/en-us/download/' + $((invoke-webrequest 'http://aka.ms/wmf5latest' -UseBasicParsing).links | ? Class -eq 'mscom-link download-button dl' | % href) | |
# Parse confirmation page and look for URL to file | |
$directURL = (invoke-webrequest $confirmationPage -UseBasicParsing).Links | ? Class -eq 'mscom-link' | ? href -match 'Win8.1AndW2K12R2-KB3134758-x64.msu' | % href | select -first 1 | |
# Download file to local | |
$download = invoke-webrequest $directURL -OutFile $env:Temp\wmf5latest.msu | |
# Install quietly with no reboot | |
if (test-path $env:Temp\wmf5latest.msu) { | |
start -wait $env:Temp\wmf5latest.msu -argumentlist '/quiet /norestart' | |
} |
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
--We will assume that my_table table is in my_published_db and it is part of my_publication. | |
USE my_published_db | |
GO | |
EXEC sp_scriptpublicationcustomprocs @publication='my_publication' |
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
-- Remove database from Availability Group: | |
Alter Database [StackExchange.Bicycles.Meta] SET HADR OFF; | |
-- Apply t-logs to catch up. This can be done manually in SSMS or via: | |
RESTORE LOG [StackExchange.Bicycles.Meta] FROM DISK = '\\ny-back01\backups\SQL\_Trans\SENetwork_AG\StackExchange.Bicycles.Meta\StackExchange.Bicycles.Meta_LOG_20160217_033201.trn' WITH NORECOVERY; | |
-- Re-join database to availability group | |
ALTER DATABASE [StackExchange.Bicycles.Meta] SET HADR AVAILABILITY GROUP = [SENetwork_AG]; | |
ALTER DATABASE [StackExchange.Bicycles.Meta] SET HADR RESUME; |
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
/******************************************************************** | |
* * | |
* Author: John Eisbrener * | |
* Script Purpose: Script out Database Role Definition * | |
* * | |
********************************************************************/ | |
DECLARE @roleName VARCHAR(255) | |
SET @roleName = 'DatabaseRoleName' |
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
internal class DisposableAction : IDisposable | |
{ | |
private readonly Action _action; | |
public DisposableAction(Action action) | |
{ | |
_action = action; | |
} | |
public void Dispose() |