Skip to content

Instantly share code, notes, and snippets.

View realFranco's full-sized avatar
🚀
On a Rocket

Franco Gil realFranco

🚀
On a Rocket
View GitHub Profile
@realFranco
realFranco / isolated_coroutine.py
Created April 5, 2022 20:28
Dont wait for async functions, create tasks and schedule those computations on the same event loop #python #python3 #asyncio #async #io #task #facyt
# Franco Gil
# @realFranco
# April 5th, 2022
class Utils:
@staticmethod
def noBlockCoroutine(coroutine):
try:
# Wrap the coro coroutine into a Task and schedule its execution.
@realFranco
realFranco / searching_bin_tree_constructor.c
Created May 31, 2022 11:03
Searching Binary Tree constructor
/* 11*10*17
- TDA arboles
31*05*21
- This is a recovery file, expose a preview on binary trees data structures.
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
@realFranco
realFranco / oauth1_signature_python_example.py
Last active July 1, 2022 12:14
OAuth 1a - Appendix A.5.1. Generating Signature Base String - Implementation in Python #python #oauth #sha1
"""
Github @realFranco
Testing OAuth1a
"""
def test_compose_oauth1a_signature() -> None:
"""
Reference: https://oauth.net/core/1.0/#sig_base_example
@realFranco
realFranco / oauth1_netsuite_header_signature.py
Created July 1, 2022 18:34
OAuth Signature - Netsuite headers generation #oauth #netsuite #python
"""
Github: @realFranco
References:
- https://oauth.net/core/1.0/
- steps:
- normalize request parameters
- create sign key
@realFranco
realFranco / join_python.py
Created July 19, 2022 18:45
After watching a live coding interview experience I decided to develop the solution for the problem. #python #pyton3 #codinginterview #coding #interview #test
"""
Write a function that perform as an SQL-join.
"""
BRAND = [
{'id': 0, 'name': 'Ferrari', 'year': 1998},
{'id': 1, 'name': 'Red Bull'},
{'id': 2, 'name': 'Mclaren'}
@realFranco
realFranco / input
Created July 21, 2022 14:39
lapieza.io - Assessment | Stock
8
1
4 9 5 2 6 7 8 1 8
1 3 0 0
0 0 1 1 3
2 6 0 0 1 7
2 6 1 0 1 7 1 1 3 4
0 1 2 3 4 5 6
0 1 2 0 1 6
@realFranco
realFranco / docker-change-data-root.sh
Last active August 30, 2022 22:43
Change the "data-root" from the "docker" service, with the goal to reduce utilization on the "/var" partition.
# Motivation: As the "/var" partition (Linux Debian) could have a limited size
# and "docker" by default set volumes and images inside of "/var/lib" the partition
# could run out ouf space soon.
#
# My approach is to modify the "data-root" argument from the docker daemon, and move
# all the data into a partition with more free space ("home" in my case).
> docker version
Client:
@realFranco
realFranco / docker-compse-upgrade-minor-version.sh
Created September 9, 2022 16:44
Upgrade docker-compose to 1.2.7.0 on ubuntu 20.04 LTS
> docker version
# mi versión de docker compose actual no me permite ejecutar compose > 3.7
> docker-compose -v
# docker-compose version 1.25.0, build unknown
> which docker-compose
# /usr/bin/docker-compose
# backup the old docker-compose
@realFranco
realFranco / docker-compose-v2.sh
Created September 16, 2022 14:32
Install Docker Compose v2 inside ubuntu 20.04 LTS
mkdir -p ~/.docker/cli-plugins
curl -sSL https://github.com/docker/compose/releases/download/v2.11.0/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
docker compose version
# Docker Compose version v2.11.0
# This will let you run docker compose in the new form `docker compose .f compose.yaml up`
@realFranco
realFranco / mock_s3.py
Created December 3, 2022 17:55
Apply a unit test at the AWS S3 service `get_object`. #aws #boto3 #botocore
"""
This code doesn't belongs to @realFranco.
See: https://stackoverflow.com/questions/72253062/write-unit-tests-for-python-lambda-using-botocore-stub-stubber
"""
import json
import boto3