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
| AWSTemplateFormatVersion: '2010-09-09' | |
| Description: AWS EU West 1 VPN gateway with connections to Azure. | |
| Parameters: | |
| VpcId: | |
| Type: AWS::EC2::VPC::Id | |
| Description: ID of the existing VPC. | |
| SubnetId: | |
| Type: AWS::EC2::Subnet::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
| const https = require('https'); | |
| exports.handler = async (event) => { | |
| const url = ''; | |
| const timeout = 4000; // 4 seconds | |
| return new Promise((resolve) => { | |
| const options = { | |
| method: 'GET', | |
| timeout: timeout, |
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
| AWSTemplateFormatVersion: '2010-09-09' | |
| Parameters: | |
| RedirectDomain: | |
| Type: String | |
| Default: 'https://sapo.pt' | |
| Description: 'The target domain for the redirect.' | |
| DomainsToRedirect: | |
| Type: CommaDelimitedList |
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 {DockerImageAsset} from 'aws-cdk-lib/aws-ecr-assets'; | |
| import {FoundationApp, FoundationStack, FoundationStackProps} from "@devops/cdk"; | |
| import * as cdk from 'aws-cdk-lib'; | |
| import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; | |
| import * as iam from 'aws-cdk-lib/aws-iam'; | |
| import * as ec2 from 'aws-cdk-lib/aws-ec2'; | |
| import * as ecs from 'aws-cdk-lib/aws-ecs'; | |
| import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; | |
| export class AutoScalingTestStack extends FoundationStack { |
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 requests | |
| from bs4 import BeautifulSoup | |
| from urllib.parse import urljoin, urlparse | |
| import re | |
| import time | |
| def is_valid_url(url, base_netloc): | |
| """ | |
| Check if the URL is valid and belongs to the same domain. | |
| """ |
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
| AWSTemplateFormatVersion: 2010-09-09 | |
| Description: "Personal Website" | |
| Parameters: | |
| DomainName: | |
| Type: String | |
| Description: "The domain name of website" | |
| BucketName: | |
| Type: String | |
| Description: "The 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
| import boto3 | |
| import sys | |
| # AWS Configuration | |
| vpc_id = 'your-vpc-id' | |
| elb_network_description = 'Your ELB network interface description (generated like "ELB your-elb-name")' | |
| route53_internal_hosted_zone_id = 'Your Route53 Internal hosted zone ID' | |
| route53_internal_record_name = 'your-route53-record.internal.' # Ending with dot | |
| aws_access_key = 'Your IAM Key' |
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
| #!/usr/bin/env bash | |
| set -e | |
| git config -f .gitmodules --get-regexp 'submodule\..*\.path' | while read -r key submodule_path; do | |
| http_url=$(git config --file .gitmodules --get submodule.$submodule_path.url) | |
| ssh_url=${http_url/https:\/\/github.com\//[email protected]:} | |
| git config -f .gitmodules submodule.$submodule_path.url $ssh_url | |
| git config -f .gitmodules submodule.$submodule_path.shallow true | |
| echo "Updated $submodule_name ($submodule_path) URL:" |
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
| sudo zgrep 'Ban' /var/log/fail2ban.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
| import { createGunzip } from 'node:zlib'; | |
| import { text } from 'node:stream/consumers'; | |
| import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3'; | |
| async function readGzippedFromS3(s3Client: S3Client, bucket: string, objectKey: string): Promise<string> { | |
| const command = new GetObjectCommand({ | |
| Bucket: bucket, | |
| Key: objectKey, | |
| }); | |
| const response = await s3Client.send(command); |