Skip to content

Instantly share code, notes, and snippets.

@julbrs
julbrs / list.js
Created March 4, 2024 19:19
Read dynamodb
// Importer les modules nécessaires
const = require("@aws-sdk/client-dynamodb");
const { DynamoDBDocumentClient, ScanCommand } = require("@aws-sdk/lib-dynamodb");
// Initialiser le client
const dynamoDBClient = new DynamoDBClient({ region: "us-west-2" }); // Remplacez par votre région
const ddbDocClient = DynamoDBDocumentClient.from(dynamoDBClient);
// Définir la table à scanner
const tableName = "YourTableName"; // Remplacez par le nom de votre table
// Créer la commande de scan
const scanCommand = new ScanCommand();
@julbrs
julbrs / FunctionsAlarm.ts
Created October 17, 2023 15:07
Setup cloudwatch alarms on SST !
// name: FunctionsAlarm.ts
// can be used with:
// new FunctionsAlarm(stack, 'ApiAlarmMain', {
// api,
// alarmNamePrefix: `API Error`,
// });
//
// new FunctionsAlarm(stack, 'ApiAlarmMain', {
// functions: [cron.jobFunction],
// alarmNamePrefix: `Cron Job Error`,
@julbrs
julbrs / README.md
Last active April 13, 2022 17:31
AWS CLI tricks

I will list here some AWS CLI tricks I use sometime ;)

List all own AMI with lastLaunchedTime on each AMI

This is possible since March, 9th 2022! See the corresponding AWS page here.

aws ec2 describe-images --owners self --query 'Images[*].[ImageId]' --output text | xargs -I {} aws ec2 describe-image-attribute --image-id {} --attribute lastLaunchedTime --query '[ImageId, LastLaunchedTime.Value]' --output text > ami_last_launch_time.csv
@julbrs
julbrs / README.md
Created February 19, 2022 16:23 — forked from Eyjafjallajokull/README.md
AWS EBS - Find unused snapshots

This script can help you find and remove unused AWS snapshots and volumes.

There is hardcoded list of regions that it searches, adjust the value to suit your needs.

Use snapshot.py snapshot-report to generate report.csv containing information about all snapshots.

snapshot.py snapshot-cleanup lets you interactively delete snapshot if it finds it is referencing unexisting resources.

./snapshots.py --help
@julbrs
julbrs / log_duration.py
Last active June 22, 2020 21:39
360eyes log duration scanner
#!/usr/bin/env python
import re
import sys
from datetime import datetime
MIN_THRESHOLD = int(sys.argv[2])
regCompile = r"(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) .* FINE Opening .*: (\d*#.*)"
filePath = sys.argv[1]
@julbrs
julbrs / - My BOBJ Toolbox.md
Last active January 23, 2020 14:25
BOBJ things

My BOBJ toolbox

Various scripts to help playing with a SAP Business Object system.

  • GetAllWebi.java will save webi files on disk
  • RescheduleInstance.java will generate instances to simulate a big system
@julbrs
julbrs / README.md
Last active December 13, 2019 15:49
Oracle cheat sheet

Oracle DB

Here is some SQL query to create an user with default auth:

CREATE USER user IDENTIFIED BY pw DEFAULT TABLESPACE users;
GRANT CONNECT TO user;
GRANT RESOURCE TO user;
ALTER USER user QUOTA UNLIMITED ON users;
ALTER USER user quota unlimited on users;
@julbrs
julbrs / awsco.py
Created December 14, 2018 17:41
Simple script to list/connect via *RDP/SSH* a AWS EC2 instance
#!/usr/bin/python3
from collections import defaultdict
import boto3
import sys
import os
import time
"""
A tool for retrieving basic information from EC2 instances. Then when you
@julbrs
julbrs / README.md
Last active September 18, 2019 19:05
Installer BOXiR2/3.x sur CentOS 5.4

Installer CentOs 5.4

  • Installation réseau sur ftp://ftp.free.fr/mirrors/ftp.centos.org/5.4/os/i386/

  • Faire un partitionnement manuel tout le disque sur / de type ext2

  • Définir un nom d'hote sympa (genre centos1). Attention, après il faut que ce nom soit associé à l'adresse IP externe sur eth0, sinon l'exterieur ne pourra pas communiquer avec le serveur BO (il faut donc modifier le fichier /etc/hosts)

  • Installer le minimum de paquets

    Installer les VirtualBox Additions yum clean all yum install gcc -y

Very easy, a new command have been introduced recently :
VBoxManage.exe modifyhd --resize size\_in\_mb\_wanted my\_disk.vdi
Then you will have to grow up wanted partition, to fit the new disk. The easiest way is to use GParted, from a SystemRescueCdfor example !