Skip to content

Instantly share code, notes, and snippets.

View nelsondev19's full-sized avatar
😃
Hello!

Nelson Hernández nelsondev19

😃
Hello!
View GitHub Profile
@nelsondev19
nelsondev19 / convertSecondsToTime.ts
Created June 6, 2023 17:43
Function for convert time position from captions to time clock format | Whisper model captions
// OUTPUT FROM WHISPER CAPTIONS
/*
const captions = [
{
"start": 22.64,
"end": 29.080000000000002,
"text": " rolas en el top 10, hubo un tiempo que tenía en Spotify las 5"
}
]
@nelsondev19
nelsondev19 / getProfileImageMicrosoft.ts
Last active May 21, 2023 16:51
Get profile image from Microsoft with TypeScript
export const getImageProfileMicrosoft = (accessToken: string) => {
const headers = new Headers();
headers.append("Authorization", `Bearer ${accessToken}`);
fetch("https://graph.microsoft.com/v1.0/me/photo/$value", {
method: "GET",
headers: headers,
})
.then((response) => {
if (!response.ok) {
import axios from 'axios';
import fs from 'fs';
const url = '<your-pre-signed-url>';
const filePath = '<path-to-your-mp4-file>';
const fileStream = fs.createReadStream(filePath);
axios.put(url, fileStream, {
headers: {
@nelsondev19
nelsondev19 / docker-compose.yml
Last active June 28, 2022 17:51
How to monitor PostgreSQL with Prometheus and Grafana | Docker
version: "3.9"
services:
grafana:
image: grafana/grafana
ports:
- 3000:3000
prometheus:
image: prom/prometheus
ports:
@nelsondev19
nelsondev19 / docker-compose.yml
Last active April 12, 2024 08:18
How to monitor Redis with Prometheus and Grafana | Docker
version: "3.9"
services:
grafana:
image: grafana/grafana
ports:
- 3000:3000
prometheus:
image: prom/prometheus
ports:
@nelsondev19
nelsondev19 / azure_blob_storage_javascript.js
Created January 5, 2022 02:21
Azure Blob Storage with JavaScript (Express JS)
import { BlobServiceClient } from "@azure/storage-blob";
import { config } from "dotenv";
config();
const blobService = BlobServiceClient.fromConnectionString(
process.env.AZURE_STORAGE_CONNECTION_STRING
);
// Methods for blobs (Files)
@nelsondev19
nelsondev19 / google_calendar_python.py
Last active July 8, 2022 14:37
Google Calendar API con Python
from os import path
import pickle
from google.auth.transport.requests import Request
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
# IF YOU MODIFY THE SCOPE DELETE THE TOKEN.TXT FILE
SCOPES = ['https://www.googleapis.com/auth/calendar.events',
'https://www.googleapis.com/auth/calendar']
@nelsondev19
nelsondev19 / azure_blob_storage_python.py
Last active February 18, 2023 20:11
The main methods to use with Azure Blob Storage and python
from os import getenv
from azure.storage.blob import BlobServiceClient
blob_service_client = BlobServiceClient.from_connection_string(
getenv("AZURE_STORAGE_CONNECTION_STRING"))
### Methods for blobs (Files)
def upload_blob(filename: str, container: str, data: BinaryIO):
try:
@nelsondev19
nelsondev19 / optimization-images-fastapi.py
Created November 19, 2021 22:10
Optimization of images with FastAPI (Python)
from fastapi import FastAPI, UploadFile, File, BackgroundTasks
from fastapi.responses import JSONResponse
from os import getcwd
from PIL import Image
app = FastAPI()
PATH_FILES = getcwd() + "/"
import { Fragment, useState } from "react";
function App() {
const [Autos] = useState(["volvo", "saab", "mercedes", "audi"]);
const [ValueSelected, setValueSelected] = useState(0);
const toggle = (AutoSeleccionado) => {
const indexSelected = Autos.findIndex((auto) => auto === AutoSeleccionado);
setValueSelected(indexSelected);