git init
git status
git add <filename>
git commit -m "commit message"
git log
git remote add origin
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 json | |
import boto3 | |
def lambda_handler(event, context): | |
# TODO implement | |
for e in event['Records']: | |
bucket_name = e['s3']['bucket']['name'] | |
object_key = e['s3']['object']['key'] | |
print(bucket_name) |
docker log limit
method 1 -> docker run example
docker run -d \
--log-driver json-file \
--log-opt max-size=5k \
--log-opt max-file=10 \
chentex/random-logger:latest
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
openssl aes-128-cbc -d -K babb4a9f774ab853c96c2d653dfe544a -iv 00000000000000000000000000000000 -in "${HOME}/Library/DBeaverData/workspace6/General/.dbeaver/credentials-config.json" | dd bs=1 skip=16 2>/dev/null |
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
1 | |
Below worked for me in AWS CENTOS 🦊 - Amazon Linux 2 AMIS( Karoo) | |
Step 1 : Update the EBS volume from AWS console of attached EC2 | |
Step 2 : Login( SSH ) to EC2 instance in which the volume is attached |
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 AWS = require('aws-sdk'); | |
exports.handler = async (event, context) => { | |
console.log(JSON.stringify(event)) | |
// ================================ | |
// Define your backups | |
// ================================ | |
const instanceName = event.instanceName || process.env['instanceName']; | |
const backupDaysMax = event.days || process.env['days']; // keep at least 7 daily backups |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": [ | |
"arn:aws:s3:::<bucket-name>/file1.txt", | |
"arn:aws:s3:::<bucket-name>/file2.txt" |
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 json | |
import urllib.parse | |
import boto3 | |
import os | |
print('Loading function') | |
s3 = boto3.client('s3') | |
TOPIC_ARN = os.environ['topicARN'] | |
def lambda_handler(event, context): |
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
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` | |
#Set the Region | |
AZ=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone -H "X-aws-ec2-metadata-token: $TOKEN"` | |
export AWS_DEFAULT_REGION=${AZ::-1} | |
echo $AWS_DEFAULT_REGION | |
#Retrieve latest Linux AMI | |
AMI=$(aws ssm get-parameters --names /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 --query 'Parameters[0].[Value]' --output text) | |
echo $AMI |
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
create database aws; | |
use aws; | |
CREATE TABLE RESTART ( | |
StudentID int not null AUTO_INCREMENT, | |
StudentName varchar(255), | |
RestartCity varchar(255), | |
GraduationDate Datetime, | |
PRIMARY KEY (StudentID) | |
); |
NewerOlder