Skip to content

Instantly share code, notes, and snippets.

View juanpablocs's full-sized avatar
💭
👨‍💻 Coding..

Juan pablo juanpablocs

💭
👨‍💻 Coding..
View GitHub Profile
@juanpablocs
juanpablocs / subtitle_video.md
Created June 29, 2024 05:30
Extract subtitle from video with openia Api Whisper-1

Extract subtitle from video

Assuming you have a video file named myvideo.webm, the first step is to extract the audio. To manage API limitations effectively, compress the audio as much as possible.

ffmpeg -i myvideo.webm -ac 1 -b:a 16k -map a output.webm

FFmpeg parameters explained:

@juanpablocs
juanpablocs / s3cmd.md
Last active June 22, 2024 01:35
S3CMD commands

Commands utils s3cmd

Upload files to bucket

s3cmd sync [FOLDER]/* s3://[BUCKET] --no-progress --no-progress --acl-public --recursive

Update cors to bucket

s3cmd setcors ./cors_rule.xml s3://[BUCKET]
@juanpablocs
juanpablocs / observability_app.md
Last active June 17, 2024 05:53
Observability with Grafana and docker.

Simulate app

need install loki plugin

docker plugin install grafana/loki-docker-driver:2.9.2 --alias loki --grant-all-permissions

docker command for up container and save logs with loki driver plugin

docker run -d \
@juanpablocs
juanpablocs / docker.md
Last active April 13, 2024 02:34
Docker run vps

Docker run web

first create Dockerfile second build 3 push on registry github or vultr

Docker nginx basic

FROM nginx:latest

SelectBox Typescript

version 1

import React, { FC } from 'react';

// Definición de tipos
interface Option {
  label: string;
  value: string;
@juanpablocs
juanpablocs / encoding.md
Last active March 22, 2024 22:15 — forked from Andrey2G/encoding.txt
Video Encoding with multiple resolutions

Encoder mp4 to m3u8

ffmpeg -i https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_30mb.mp4 \
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 \
-c:v libx264 -crf 22 -c:a aac -ar 48000 \
-filter:v:0 scale=w=480:h=360  -maxrate:v:0 600k -b:a:0 64k \
-filter:v:1 scale=w=640:h=480  -maxrate:v:1 900k -b:a:1 128k \
-filter:v:2 scale=w=1280:h=720 -maxrate:v:2 900k -b:a:2 128k \
-var_stream_map "v:0,a:0,name:360p v:1,a:1,name:480p v:2,a:2,name:720p" \
@juanpablocs
juanpablocs / vite-library-npm.md
Last active October 18, 2023 22:34
create library npm

Publish library on github registry NPM

configure github action:

name: Publish Library
on:
 release:
   types: [created]
jobs:
 publish-library:
@juanpablocs
juanpablocs / tipo_de_cambio.md
Created April 6, 2021 05:45
Tipo de cambio Sunat Api TXT
@juanpablocs
juanpablocs / sunat.md
Last active September 4, 2023 20:10
Ver RUC de la Sunat con node.js sin captcha. Simple y rápido.

Ruc Sunat

Obtener resultados sin necesidad de captcha ni ocr. Simple código

Instalar paquetes

npm init -y
npm i request cheerio --save

Run

@juanpablocs
juanpablocs / mongo_bash.md
Last active July 19, 2023 18:20
mongo dump bash

Mongo dump bash

download all db with gzip mongo backup and delete backups old 10 days before

#!/bin/bash
BACKUP_DIR="$HOME/Backup/my-site"
DATE=$(date +"%Y%m%d")
BACKUP_FILE="$BACKUP_DIR/my-site_$DATE.gz"
DAYS_TO_KEEP=10