Skip to content

Instantly share code, notes, and snippets.

View filipedfs's full-sized avatar
👨‍🎓
In the middle of the journey

Filipe Fonseca filipedfs

👨‍🎓
In the middle of the journey
View GitHub Profile
@filipedfs
filipedfs / gist:1ec253fdbed8f2bba2201ce1b6112ae4
Created March 5, 2019 18:54 — forked from jNizM/gist:019696878590071cf739
[AHK] GUI - How-to draw a line / frame
; http://ahkscript.org/boards/viewtopic.php?f=7&t=8846
; https://dl.dropboxusercontent.com/u/186419968/Scripte/Gui/Gui_Draw_Line.png
; GLOBAL SETTINGS ===============================================================================================================
#Warn
#NoEnv
#SingleInstance Force
SetBatchLines -1
@filipedfs
filipedfs / gist:f6a9752ebafcee4327fecd931fa29e72
Created May 19, 2020 18:00
Generate black video from ffmpeg
ffmpeg -t 5 -f lavfi -i color=c=black:s=1280x720 -c:v libx265 output.mp4
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@filipedfs
filipedfs / sleep.js
Created December 13, 2020 01:40
Sleep in Javascript using Promise
await new Promise((resolve)=>setTimeout(resolve, 2000));
@filipedfs
filipedfs / convert_to_audio.py
Created December 13, 2020 14:18
Convert all media files from a folder to audio
import subprocess
import os
#%%
current_directory: str = os.getcwd()
working_directory = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
#%%
def convert_to_audio(filename, file_extension):

some tools for diagrams in software documentation

Diagrams For Documentation

Obvious Choices

ASCII

version=$1
if [ -z "$version" ]
then
echo "The version of the release: "
read -r version
fi
if [ -z "$version" ]
then
echo Version not defined
else
@filipedfs
filipedfs / main.dart
Created June 9, 2021 18:19
Format CPF
void main() {
final String text = '11122233344';
print(maskText(text, 'CPF'));
}
String maskText(String text, String type) {
// Format CPF.
if (type == 'CPF') {
final List<String> chars = text.split('');
@filipedfs
filipedfs / kubernetes_commands.sh
Last active June 30, 2022 18:32
Kubernetes commands
# List nodes
kubectl get nodes
# List pods
kubectl get pods
# List services
kubectl get services
# Apply a monifest file
@filipedfs
filipedfs / query_postgres_jsonb.sql
Last active October 25, 2021 19:02
Postgres query to search inside jsonb
-- {"contacts":[{"phoneNumber":987654321}]} See: https://www.postgresql.org/docs/12/functions-json.html
SELECT contacts
FROM customer
WHERE contacts @? '$[*] ? (@.phoneNumber == 987654321)';
-- Other way
WITH data AS (
SELECT jsonb_array_elements(contacts)->>'phoneNumber' "phoneNumber"
FROM customer
)