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 cloudwatch API with Boto3 to get the highest requests per second over a given month for wafv2 | |
import boto3 | |
from datetime import datetime, timedelta | |
client = boto3.client("cloudwatch") | |
response = client.get_metric_statistics( | |
Namespace="AWS/WAFV2", | |
MetricName="AllowedRequests", | |
Dimensions=[ | |
{"Name": "WebACL", "Value": "test"}, |
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
public void readSecret() { | |
try { | |
URL yahoo = new URL("http://localhost:2773/secretsmanager/get?secretId=/authorizer/jwt"); | |
URLConnection yc = yahoo.openConnection(); | |
yc.setRequestProperty("X-Aws-Parameters-Secrets-Token", System.getenv("AWS_SESSION_TOKEN")); | |
BufferedReader in = new BufferedReader( | |
new InputStreamReader( | |
yc.getInputStream())); | |
String inputLine; |
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
Parameters: | |
instanceType: | |
Description: Instance type | |
Type: String | |
Default: r6i.xlarge | |
availabilityZone: | |
Description: Availability Zone | |
Type: String | |
Default: us-east-1i | |
vpcId: |
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
fields @timestamp, @message | |
| parse @message "* * * * * * * * * * * * * *" as version, account_id, interface_id, srcaddr, dstaddr, srcport, dstport, protocol, packets, bytes, start, end, action, log_status | |
| filter action = "REJECT" | |
| sort @timestamp desc | |
| limit 2000 |
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 http = require('http'); | |
//create a server object: | |
http.createServer(function (req, res) { | |
res.write(JSON.stringify(req.headers)); //write a response to the client | |
res.end(); //end the response | |
}).listen(3000); //the server object listens on port 8080 |
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
version: "3" | |
services: | |
# this could be enabled once the server container is added | |
server: | |
build: | |
. | |
depends_on: | |
- database | |
- redis |
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
while IFS= read line; do | |
git clone --bare git@github.com:arup-group/$line.git | |
cd $line.git | |
git push --mirror git@github.com:parup-group/$line.git | |
rm -fr $line.git | |
done |
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 | |
client = boto3.client('cloudwatch') |
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
# lib/shorten_array.rb | |
module ShortenArray | |
def self.first_two_items(array) | |
[array[0], array[1]] | |
end | |
end |
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
# spec/shorten_array_spec.rb | |
require 'shorten_array.rb' | |
describe ShortenArray do | |
it 'returns the first 2 items from the array' do | |
best_array_ever = %w[best array ever] | |
result = ShortenArray.first_two_items(best_array_ever) | |
expect(result).to eq %w[best array] | |
end | |
end |
NewerOlder