Skip to content

Instantly share code, notes, and snippets.

View hugoleodev's full-sized avatar
🎯
Focusing

Hugo Leonardo hugoleodev

🎯
Focusing
View GitHub Profile
@hugoleodev
hugoleodev / 00_destructuring.md
Created June 19, 2022 01:47 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

[{"args":{"name":"swapper"},"cat":"__metadata","name":"thread_name","ph":"M","pid":0,"tid":0,"ts":0},
{"args":{"name":"Compositor"},"cat":"__metadata","name":"thread_name","ph":"M","pid":84685,"tid":41219,"ts":0},
{"args":{"name":"CrBrowserMain"},"cat":"__metadata","name":"thread_name","ph":"M","pid":72630,"tid":259,"ts":0},
{"args":{"name":"ThreadPoolServiceThread"},"cat":"__metadata","name":"thread_name","ph":"M","pid":72644,"tid":38159,"ts":0},
{"args":{"name":"ThreadPoolForegroundWorker"},"cat":"__metadata","name":"thread_name","ph":"M","pid":84685,"tid":33539,"ts":0},
{"args":{"name":"CrRendererMain"},"cat":"__metadata","name":"thread_name","ph":"M","pid":84685,"tid":259,"ts":0},
{"args":{"name":"Chrome_IOThread"},"cat":"__metadata","name":"thread_name","ph":"M","pid":72630,"tid":33027,"ts":0},
{"args":{"name":"VizCompositorThread"},"cat":"__metadata","name":"thread_name","ph":"M","pid":72644,"tid":34563,"ts":0},
{"args":{"name":"CrGpuMain"},"cat":"__metadata","name":"thread_name","ph":"M","pid":72644,"t
@hugoleodev
hugoleodev / gist:31c5bdd5f89a6be118c332f3b2fb2173
Created September 28, 2021 23:24 — forked from jeoliva/gist:a3c4ef62b7f52926d0f339b395c0cd0c
Get Keyframe interval (GOP size) of a stream/video using ffprobe
ffprobe -of compact -select_streams v -show_packets [VIDEO_FILE OR STREAM_URL] | grep K$ | awk 'BEGIN{FS="|";last=-1}{split($5,a,"="); if(last != -1) {print "Keframe pos: " a[2] ", Interval: " a[2]-last " seconds"} else {print "Keyframe: " a[2]}; last=a[2]}'
@hugoleodev
hugoleodev / gist:1178ac72f6f8eae8a91d7d14fec70a11
Created September 28, 2021 23:24 — forked from tayvano/gist:6e2d456a9897f55025e25035478a3a50
complete list of ffmpeg flags / commands
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
@hugoleodev
hugoleodev / predict.py
Created July 6, 2021 19:53 — forked from greencoder/predict.py
SKLearn Linear Regression Stock Price Prediction
from __future__ import print_function
import numpy as np
import pandas as pd
import talib as ta
import pandas_datareader as web
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import Ridge
from sklearn.model_selection import cross_val_score
@hugoleodev
hugoleodev / srt_video_split.py
Last active May 13, 2021 01:32
Splits videos based on its subtitle file
from typing import Any, Generator, TextIO
import ffmpeg
from srt import Subtitle
from srt import parse as srt_parse
def segments(file: TextIO) -> Generator:
return srt_parse(file.read())
test:
@python tests.py
{
"title":"ge",
"description":"O app oficial do globoesporte agora \\u00e9 ge; com tudo sobre o seu time e esportes favoritos\\r\\n\\r\\n<b>SIGA SEU TIME</b>\\r\\nInforma\\u00e7\\u00f5es sobre o seu time do cora\\u00e7\\u00e3o.\\r\\n\\r\\n<b>V\\u00cdDEOS</b>\\r\\nAssista aos principais lances e reportagens.\\r\\n\\r\\n<b>NOT\\u00cdCIAS</b>\\r\\nFique por dentro do mundo dos esportes.\\r\\n\\r\\n<b>TABELAS</b>\\r\\nAcompanhe a posi\\u00e7\\u00e3o do seu time nos campeonatos.\\r\\n\\r\\n<b>AGENDA</b>\\r\\nSaiba quando v\\u00e3o rolar os principais jogos.\\r\\n\\r\\n<b>ALERTAS</b>\\r\\nSeja avisado sobre as principais novidades.\\r\\n\\r\\n\\r\\nCAMPEONATOS NACIONAIS:\\r\\n\\r\\n- Brasileir\\u00e3o s\\u00e9rie A\\r\\n- Brasileir\\u00e3o s\\u00e9rie B\\r\\n- Brasileir\\u00e3o s\\u00e9rie C\\r\\n- Brasileir\\u00e3o s\\u00e9rie D\\r\\n- Copa do Brasil\\r\\n\\r\\n\\r\\nCAMPEONATOS REGIONAIS E ESTADUAIS:\\r\\n\\r\\n- Paulista\\r\\n- Carioca\\r\\n- Mineiro\\r\\n- Paranaense\\r\\n- Ga\\u00facho\\r\\n- Baiano\\r
@hugoleodev
hugoleodev / tests.py
Created November 24, 2020 22:24
tests.py
import unittest
import responses
import json
from unittest.mock import patch
from main import httpbin_requester, fetch_google_play_installs
class HTTPBinRequesterTestCase(unittest.TestCase):