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 / 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 / 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 / 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 / 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 / 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 / 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 / dt_bench.py
Created December 17, 2021 18:52
Datetime Benchmark - Given a timestamp in seconds (epoch), return the day of the week
from math import ceil
import random
import pytz
from datetime import date
import pandas as pd
def dates_gen(cases: int = 1000) -> list:
return [random.randint(0, 1639758915) for _ in range(0, cases)]
#!/usr/bin/env jjs
/*####################################################################################################################################
# As Nashorn does not have http capabilities through XMLHttpRequest (DOM API), we have to use regular Java classes instead.
# This sample shows how this can be acheived without depending on any third party libraries. Just a standard Java 8 JDK.
# Make sure to have JAVA_HOME/bin on your PATH for the shebang to work. Then just chmod +x away and run...
# Alternatively if you're on a non *nix OS, start with jjs -scritping httpsample.js
####################################################################################################################################*/
var url = "https://api.github.com/users/billybong/repos";
var response;
@realFranco
realFranco / naive_string_matcher.py
Created November 9, 2021 23:06
String Matcher Algorithm - Naive
"""
November 9th, 2021
Naive Implmementation
Exacution example
> python3 string_match.py
"""
class StringMatch():
text: str
@realFranco
realFranco / comunas_standard_820.json
Last active September 24, 2021 13:31
Example data definition for Chilean political distribution, based on "Norma 820"
{
"region": {
"01": { "code": "01", "name": "Tarapacá", "abreviation": "TPCA" }
},
"province": {
"011": { "code": "011", "name": "Iquique"}
},
"comune": {
"01101": { "code": "01101", "code_comune_2018": "01101", "name": "Iquique"},
}