Skip to content

Instantly share code, notes, and snippets.

@afalahi
afalahi / request.rb
Created April 5, 2022 19:50 — forked from zaru/request.rb
AWS SNS publish api curl request
require 'json'
require 'aws-sigv4'
require 'active_support/core_ext'
params = {
'Action' => 'Publish',
'TargetArn' => 'arn:aws:sns:ap-northeast-1:000000000000:example-topic',
'Message' => 'message',
'Version' => '2010-03-31'
}.to_query
{
"eventId": "3o9jBzq1SmOGmmsDsqyyeQ",
"eventTime": "2020-01-17T21:23:56.000Z",
"eventType": "com.okta.user.credential.password.import",
"eventTypeVersion": "1.0",
"contentType": "application/json",
"cloudEventVersion": "0.1",
"source": "https://${yourOktaDomain}/api/v1/inlineHooks/cal2xd5phv9fsPLcF0g7",
"data": {
"context": {
@afalahi
afalahi / create-nat-switch.ps1
Created September 21, 2018 18:42
create-nat-switch
$VerbosePreference = "Continue"
Write-Verbose -Message "Creating the VM Switch"
$SwitchName=Read-Host "Switch Name"
New-VMSwitch -Name "$SwitchName" -SwitchType Internal
Write-Verbose -Message "Switch Created Successfully"
Write-Verbose -Message "Assiging IP and SubnetMask to $SwitchName"
$GateWay= Read-Host "Enter Gatway Address"
$prefixLength = 24
$ifIndex = Get-NetAdapter | Where {$_.Name -like "*$SwitchName*"}
New-NetIPAddress -IPAddress $GateWay -PrefixLength $prefixLength -InterfaceIndex $ifIndex.ifIndex