Skip to content

Instantly share code, notes, and snippets.

View po5i's full-sized avatar
🪴
Keep coding

Carlos V. po5i

🪴
Keep coding
View GitHub Profile
@po5i
po5i / main.py
Created July 1, 2022 18:44
Print a list of repositories - Supports async
import requests
import aiohttp
BASE_URL = "https://api.github.com/users/{}/repos"
def get_repos(username: str) -> None:
response = requests.get(BASE_URL.format(username))
try:
import asyncio
from main import get_repos_async
async def bulk_get_repos_async() -> None:
tasks = []
tasks.append(get_repos_async("python"))
tasks.append(get_repos_async("globant"))
from multiprocessing import Process
from main import get_repos
if __name__ == "__main__":
tasks = []
tasks.append(Process(target=get_repos, args=("python",)))
tasks.append(Process(target=get_repos, args=("globant",)))
from threading import Thread
from main import get_repos
if __name__ == "__main__":
tasks = []
tasks.append(Thread(target=get_repos, args=("python",)))
tasks.append(Thread(target=get_repos, args=("globant",)))
@po5i
po5i / main.py
Created July 1, 2022 18:39
Print the list of repos for a specific user
import requests
BASE_URL = "https://api.github.com/users/{}/repos"
def get_repos(username: str) -> None:
response = requests.get(BASE_URL.format(username))
try:
print(f"Repositories from {username}:")
@po5i
po5i / ddd.md
Created May 12, 2022 15:31
Domain Driven Development Acamica notes

Some Resources

In this last lesson we only want to put together valuable information for you, look at it as a last lecture. We are going to check the nex topics:

  • Source Code
  • Architecture Styles and Patterns Links
  • DDD Checklists Created during the course
  • References to literature used in the course

Source Code

@po5i
po5i / measure-decorator.py
Created December 18, 2020 19:59
Time measure decorator for Python
from functools import wraps
from time import process_time
def measure(func):
@wraps(func)
def _time_it(*args, **kwargs):
start = int(round(process_time() * 1000))
try:
return func(*args, **kwargs)
@po5i
po5i / launch.json
Created November 28, 2018 20:46
Mocha run and debug tests
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Test All",
@po5i
po5i / gist:b7c1f7230277bdb4aa5ce68c66b37eed
Created November 11, 2018 17:02 — forked from burnash/gist:d6d35fbabd2566f2b1b9
Find strings with non-latin characters in files
import sys
import os
import codecs
import unicodedata as ud
# from http://stackoverflow.com/questions/3094498/how-can-i-check-if-a-python-unicode-string-contains-non-western-letters
latin_letters = {}
@po5i
po5i / inline-svg-function.scss
Created September 5, 2018 19:47 — forked from JacobDB/inline-svg-function.scss
Inline SVG function [SASS]
// Replace letters
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}