Skip to content

Instantly share code, notes, and snippets.

View iklobato's full-sized avatar
🏠
Working from home

iklobato iklobato

🏠
Working from home
  • Campinas
  • 19:24 (UTC -03:00)
View GitHub Profile
@iklobato
iklobato / multiprocessing.py
Created May 9, 2024 18:22
This script demonstrates the use of multiprocessing processes (`Writer`, `Drawer`, and `Assembler`) with synchronization using `Condition` and `Event` objects to execute sequential tasks in a concurrent environment.
import logging
from multiprocessing import Process, Condition, Event
import time
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s (%(levelname)s): [%(processName)s] (%(funcName)s): %(message)s",
datefmt="%H:%M:%S",
)
@iklobato
iklobato / timetrack.py
Created March 21, 2024 19:33
This script generates a time tracking report by parsing Git commit messages for the current user over a specified date range. It extracts JIRA card numbers and associated commit messages, groups them by date, and outputs a formatted table showing the work done each day.
#
# pip install tabulate==0.9.0
#
#
import argparse
import datetime
import logging
import os
import re
@iklobato
iklobato / elements_distribution.py
Last active February 22, 2024 14:55
elements_distribution.py
from time import time, sleep
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from itertools import cycle, product
from queue import Queue
from typing import Union
from tabulate import tabulate
NUMBER_OF_NOTEBOOKS = 20
NUMBER_OF_QUEUES = 4
@iklobato
iklobato / ms.py
Created January 19, 2024 16:58
Mouse mover
"""
Mouse Automator
This script automates mouse movements, simulating user activity by randomly moving the mouse pointer within the screen. It uses the Quartz framework for macOS.
To run this script:
1. Make sure you are using a macOS system as Quartz is specific to macOS.
2. Install the required dependencies if not already installed:
- Quartz: This is typically available by default on macOS.
3. Copy and paste the code into a Python file (e.g., mouse_automator.py).
@iklobato
iklobato / bind_keys.md
Last active January 16, 2024 15:33
Enable Word Navigation in iTerm 2 Using Option (Alt) and Arrow Keys

Optimize iTerm 2 Word Navigation Configuration

Enhance your iTerm 2 command-line experience with improved word navigation. This guide covers two approaches: a convenient one-liner script and a manual method.

One-Liner Approach

Learn how to quickly configure word navigation in iTerm 2 using a one-liner script. This script enhances key bindings with the Option (Alt) key and arrow keys, facilitating smooth movement one word backward and forward.

Implementation

@iklobato
iklobato / study_plan.md
Last active January 15, 2024 21:46
Comprehensive 30-Day Algorithm Study Plan for Coding Interviews

INTERVIEWS

Comprehensive 30-Day Algorithm Study Plan for Coding Interviews

Based on: https://www.hackerrank.com/interview/interview-preparation-kit

This 30-day study plan is meticulously crafted to help you achieve a comprehensive understanding of fundamental algorithmic concepts, strategically tailored for success in coding interviews. The primary goal of this plan is to equip you with the skills and knowledge required to confidently tackle algorithmic challenges commonly encountered during technical interviews.

The plan kicks off with a warm-up phase, allowing you to familiarize yourself with the HackerRank environment and ease into problem-solving. As you progress through each day, the plan systematically delves into key algorithmic topics, offering a detailed breakdown of subtopics for a more thorough exploration.

@iklobato
iklobato / pyenv_install.sh
Last active January 12, 2024 01:46
pyenv linux install
#!/bin/bash
#
# Pyenv Installer Script
#
# This script automates the installation of Pyenv and the latest Python versions
# on a Debian-based system or macOS. It installs necessary dependencies, sets up Pyenv,
# restarts the terminal, and installs the latest Python versions concurrently.
#
# Note: Ensure you have sudo privileges to install system dependencies.
#
@iklobato
iklobato / docker_install.sh
Last active January 5, 2024 02:54
Docker installation on ubuntu, single script
##############################################################################
# Docker Installation Script for Ubuntu #
# #
# Automates the installation of Docker on Ubuntu systems. Checks if Docker #
# is already installed; if not, it proceeds with the installation steps. #
# #
# This script simplifies Docker installation on Ubuntu by updating package #
# lists, installing necessary dependencies like ca-certificates, curl, and #
# gnupg, setting up the Docker repository, and installing Docker CE, #
# Docker CLI, containerd.io, docker-buildx-plugin, and docker-compose-plugin #
@iklobato
iklobato / best_machine.py
Last active October 24, 2023 23:43
Scrap EC2 to get the best instance with more processing and lowest cost
from datetime import datetime
import pandas as pd
import requests
pd.set_option('display.max_columns', 8)
pd.set_option('max_seq_item', None)
pd.set_option('display.width', 200)
zones = [
'US East (N. Virginia)',
@iklobato
iklobato / bucket-migration.sh
Last active November 22, 2023 15:57
bucket-migration
#!/bin/bash
# Purpose: This Bash script automates data migration between BigQuery and Google Cloud's storage.
# It streamlines the process by using Google Cloud Storage as temporary storage. It's designed to export table
# schemas to JSON, load data from CSV files into BigQuery for analysis, and securely move data between different
# storage buckets. Additionally, it simplifies bucket management for organized data and enhanced redundancy.
# Value: For GCP users, this script is invaluable for simplifying and expediting data migration tasks between
# BigQuery, making it a crucial resource for data management.
# How to Run: Before executing, set key variables like `SOURCE_PROJECT_ID`, `DESTINATION_PROJECT_ID`,
# and `DATASET_NAME`. Then, prepare an input file listing the table names you want to process. Run the script in