Skip to content

Instantly share code, notes, and snippets.

View afpp3's full-sized avatar
:electron:

Andre Felippe afpp3

:electron:
View GitHub Profile
@afpp3
afpp3 / useBroadcastChannel.ts
Created February 8, 2024 23:29 — forked from KristofferEriksson/useBroadcastChannel.ts
A React hook that allows you to send and receive messages between browser tabs or windows
import { useCallback, useEffect, useRef, useState } from "react";
interface UseBroadcastChannelOptions {
name: string;
onMessage?: (event: MessageEvent) => void;
onMessageError?: (event: MessageEvent) => void;
}
interface UseBroadcastChannelReturn<D, P> {
isSupported: boolean;
@afpp3
afpp3 / compress_video
Created August 22, 2024 17:34 — forked from trvswgnr/compress_video
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in