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
db.getCollectionInfos().forEach(function(coll) { | |
var stats = db.getCollection(coll.name).stats(); | |
var sizeGB = (stats.size / (1024 * 1024 * 1024)).toFixed(3); | |
print(coll.name + ": " + sizeGB + " GB"); | |
}); |
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 batchSize = 100000; | |
let totalDeleted = 0; | |
const cutoff = new Date("2024-01-01T00:00:00Z"); | |
const col_name = "giscemisc_action"; | |
while (true) { | |
const docs = db[col_name].find( | |
{ create_date: { $lt: cutoff } }, | |
{ _id: 1 } | |
).limit(batchSize).toArray(); |
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
DO $$ | |
DECLARE | |
r record; | |
BEGIN | |
FOR r IN | |
SELECT table_name | |
FROM information_schema.tables | |
WHERE table_schema = 'public' | |
AND table_type = 'BASE TABLE' | |
-- Omitir las tablas que sean hypertables de Timescale |
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
#!/bin/bash | |
# Configuración del repositorio | |
OWNER="gisce" | |
REPO="erp" | |
GITHUB_API_URL="https://api.github.com" | |
GITHUB_TOKEN=${GITHUB_TOKEN} | |
MAX_PRS=150 # Definir el máximo de PRs a procesar | |
# Almacenar las PRs que cumplen el requisito |
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
#!/bin/bash | |
# Create necessary directories if they do not exist | |
mkdir -p /opt/node_exporter/metrics_folder/ | |
mkdir -p /opt/node_exporter/ram_consumption/ | |
# Create the script file with the given content | |
cat << 'EOF' > /opt/node_exporter/ram_consumption/ram_p.sh | |
#!/bin/bash |
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
#!/bin/bash | |
# Conexión a MongoDB | |
DATABASE="tuBaseDeDatos" | |
COLLECTION="tg_profile" | |
MONGO_HOST="localhost" | |
MONGO_PORT="27017" | |
# Obtener el mínimo y máximo _id | |
MIN_ID=$(mongo --quiet --host $MONGO_HOST --port $MONGO_PORT $DATABASE --eval "printjson(db.$COLLECTION.find().sort({_id: 1}).limit(1).toArray()[0]._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
#!/bin/bash | |
#./check_restapi_log_calls.sh /home/erp/var/log/restapi.log 'Apr 18 12:11:00 2024' 'Apr 18 12:25:00 2024' | |
# Input variables | |
file_path=$1 | |
start_date="$2" | |
end_date="$3" | |
# Convertir las fechas de inicio y fin a formato 'date' para comparar | |
start_timestamp=$(date -d "$start_date" '+%s') | |
end_timestamp=$(date -d "$end_date" '+%s') |
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
def clean_idle_redis_keys(redis_host='192.168.0.4', redis_port=6379, db=0, startswithkey='rq', idletime=604800): | |
import redis | |
from tqdm import tqdm | |
r = redis.StrictRedis(host=redis_host, port=redis_port, db=db) | |
for key in tqdm(r.scan_iter("*")): | |
idle = r.object("idletime", key) | |
# idle time is in seconds. | |
if idle > idletime and key.startswith(startswithkey): | |
print("Deleting {}".format(key)) | |
r.delete(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
#!/bin/bash | |
export GITHUB_TOKEN=****************************** | |
export OWNER=******** | |
export REPO=****** | |
EE=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/$OWNER/$REPO/releases/latest | grep https://api.github.com/repos/$OWNER/$REPO/releases/assets/. | cut -d : -f 2,3 | tr -d \" | tr -d ,) | |
for URL in $EE | |
do | |
echo $URL | |
name=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" $URL | grep '"name":.' | cut -d : -f 2,3 | tr -d \" | tr -d ,) |