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
// Calling the function using promises. | |
addElement("first promise sexy syntax") | |
.then(x => addElement("second promise syntax")) | |
.then(x => addElement("third promise syntax")) | |
.then(x => addElement("fourth promise syntax")) | |
// Calling the function using Async/Await | |
async function myFunction(){ | |
await addElement("first async"); | |
await addElement("second async"); |
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 context= new (window.AudioContext || window.webkitAudioContext)(); | |
var oscillator = context.createOscillator(); | |
oscillator.frequency.value = 5000; | |
oscillator.start(); | |
oscillator.connect(context.destination); | |
// Only be heard by those under 40 | |
// oscillator.frequency.value = 15000; | |
// Only be heard by those under 18 |
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
<div id="app"> | |
<button @click="disconnect" v-if="status === 'connected'">Disconnects </button> | |
<button @click="connect" v-if="status === 'disconnected'">Connect</button> {{ status }} | |
<br /><br /> | |
<div v-if="status === 'connected'"> | |
<form @submit.prevent="sendMessage" action="#"> | |
<input v-model="message"><button type="submit">Send Message</button> | |
</form> | |
<ul id="logs"> | |
<li v-for="log in logs" class="log"> |
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
using Amazon.S3; | |
using Amazon.S3.Model; | |
using System; | |
using System.Threading.Tasks; | |
namespace Amazon.DocSamples.S3 | |
{ | |
class UploadObjectTest | |
{ | |
private const string bucketName = "*** bucket 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
new Bucket(this, "MyFirstBucket", new BucketProps | |
{ | |
Versioned = true | |
}); |
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
using Amazon.Lambda.Core; | |
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. | |
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] | |
namespace demoLambda | |
{ | |
public class Function | |
{ |
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
Install-Module AWSLambdaPSCore -Scope CurrentUser | |
Get-AWSPowerShellLambdaTemplate | |
New-AWSPowerShellLambda -ScriptName RDPLockDown -Template Basic | |
Publish-AWSPowerShellLambda -ScriptPath .\RDPLockDown.ps1 -Name RDPLockDown -Region us-east-1 |
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
#Requires -Modules @{ModuleName='AWSPowerShell.NetCore';ModuleVersion='3.3.343.0'} | |
$rulesRemoved = 0 | |
Get-EC2SecurityGroup | ForEach-Object -Process { | |
$securityGroupId = $_.GroupId | |
$_.IpPermission | ForEach-Object -Process { | |
if($_.ToPort -eq 3389) { |
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
static void Main(string[] args) | |
{ | |
var prog = new Program(); | |
prog.MainAsync().Wait(); | |
} | |
private async Task MainAsync() | |
{ | |
var kmsClient = new AmazonKeyManagementServiceClient(RegionEndpoint.EUCentral1); |
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
private static async Task<T> WrapAsync<T>(Func<object[], object> target, object[] args, string name) | |
{ | |
try | |
{ | |
return await new ChaosWrap<InjectException>().Execute<T>(() => (Task<T>) target(args)); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine($"Async method `{name}` throws {e.GetType()} exception."); | |
return default; |