Skip to content

Instantly share code, notes, and snippets.

View tbernacchi's full-sized avatar
💻

Tadeu Bernacchi tbernacchi

💻
View GitHub Profile
# -*- mode: ruby -*-
# # vi: set ft=ruby :
$alias = <<SCRIPT
#!/bin/bash
cat > ~root.bashrc <<EOF
# .bashrc
# User specific aliases and functions
alias rm='rm'
---
#SELINUX
- name: Desabilitando o SeLinux
selinux: policy=targeted state=disabled
#FIREWALLD
- name: Desabilitando o firewalld
systemd: name=firewalld state=stopped enabled=no
#TIMEZONE
- name: Ajustando o timezone do sistema
timezone: name=America/Sao_Paulo
from datetime import datetime, timedelta
from pymongo import MongoClient
import bson
def get_date_90_days_ago_ms():
# Calculates the timestamp 90 days ago in milliseconds.
ninety_days_ago = datetime.now() - timedelta(days=90)
# Convert to milliseconds
return ninety_days_ago.strftime('%s')
@tbernacchi
tbernacchi / dump-collection-90-days-send-to-gcp.py
Created April 25, 2024 21:54
Mongodump collection 90 days behind and send to a Bucket on GCP. (MongoDB it's a statefulset on k8s)
import gzip
import os
from datetime import datetime, timedelta
from pymongo import MongoClient
import bson
import json
from google.cloud import storage
def get_date_90_days_ago_ms():