Skip to content

Instantly share code, notes, and snippets.

View tbernacchi's full-sized avatar
💻

Tadeu Bernacchi tbernacchi

💻
  • Cosmópolis
  • 16:33 (UTC -03:00)
View GitHub Profile
@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():
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')
# -*- mode: ruby -*-
# # vi: set ft=ruby :
$alias = <<SCRIPT
#!/bin/bash
cat > ~root.bashrc <<EOF
# .bashrc
# User specific aliases and functions
alias rm='rm'
@tbernacchi
tbernacchi / curl.md
Created May 29, 2019 20:17 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@tbernacchi
tbernacchi / install_monaco_font.sh
Created November 3, 2018 15:16 — forked from rogerleite/install_monaco_font.sh
Install Monaco font in Linux
#!/bin/bash
#script extraido de: http://paulocassiano.wordpress.com/2008/08/29/deixando-o-gedit-com-a-cara-do-textmate/
#tip for better "resolution" here: http://blog.siverti.com.br/2008/05/22/fonte-monaco-no-ubuntugedit/
cd /usr/share/fonts/truetype/
#TODO: put validation if folder already exists
sudo mkdir ttf-monaco
@tbernacchi
tbernacchi / iptables_rules.sh
Created May 9, 2018 02:22 — forked from virtualstaticvoid/iptables_rules.sh
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
apiVersion: v1
kind: Service
metadata:
name: zabbix-web
labels:
app: zabbix
spec:
ports:
- port: 80
targetPort: 80
FROM debian
RUN \
echo "deb http://ftp.us.debian.org/debian sid main" >> /etc/apt/sources.list && \
apt-get -y update && \
apt-get install -y wget && \
apt-get install -y apt-utils && \
apt-get install -y openjdk-8-jre && \
apt-get install openssh-client openssh-server -y && \
apt-get install -y uuid-runtime && \
version: '2'
services:
db:
image: "mysql:latest"
restart: always
expose:
- 3306
environment:
MYSQL_ROOT_PASSWORD: teste123
version: '2'
services:
db:
image: mysql
restart: always
expose:
- 3306
environment:
MYSQL_ROOT_PASSWORD: teste123