Skip to content

Instantly share code, notes, and snippets.

#/bin/bash
PAT=""
BROWSER="firefox"
PORT=1357
function get_javascript() {
javascript="
const key = 'numReloads';
let numReloads = localStorage.getItem(key);
@felipeasimos
felipeasimos / forever-livestream.md
Last active March 2, 2023 18:17
Cheap 24/7 radio livestreaming

How to Make a 24h Music Livestream

Stream video and audio file in loop for youtube, using FFmpeg. FFmpeg will get the job done with 2 vCPUs in this scenario (I tried with 1 vCPU on lightsail, and buffering was a frequent occurance there). Since this is a 24/7 program, paying hourly would be unsustainable. In order to avoid that, a 2vCPU VPS is what you are looking for.

Contabo and OneTSolutions are good providers for this specific VPS use case.

1. Buy cheapest VPS you can

Carefully choose your plans, test your stream locally before to calculate specifically your requirements. Using the -listen option in ffmpeg and ffplay command are great for testing locally.

@felipeasimos
felipeasimos / print_pdf
Last active February 29, 2024 13:01
Uses pdftoppm and img2sixel to print PDF pages in the terminal. requirements: xdotool, xwininfo, img2sixel, pdftoppm, python3. Usage: print_pdf [PDF] [SCALE]
#!/bin/bash
# 1. get number of pages
# 2. spawn a thread that reads up to N pages
# 3. run pdftoppm -png to mktemp
# 4. handle Ctrl+C
function print_png() {
img2sixel "${1}" 2>/dev/null
}
Coverage Badges
@felipeasimos
felipeasimos / Makefile
Last active January 20, 2023 02:24
Makefile for C/C++ projects
.PHONY: test lib debug build run coverage avg loc compile_flags docs init clean clean-objs help
help:
# This Makefile can produce a dynamic library, test binary and main executable for C/C++ projects.
# The only prerequisite is that you must have this project structure:
# myproject/
# ├── Makefile
# ├── main.c (optional)
# ├── include/
# ├── src/ (can contain one level of subfolders)
@felipeasimos
felipeasimos / ctdd.h
Last active June 1, 2022 02:28
header-file-only unit test "framework" for C for linux
#ifndef CTDD_H
#define CTDD_H
// ctdd - Single header unit test framework for C
// To use this, checkout the examples at tests/
#include <stdio.h>
#include <sys/time.h>
#define __CTDD_MESSAGE_LEN 1024
# Nodemcu
sources: \
https://www.espressif.com/sites/default/files/documentation/2c-esp8266_non_os_sdk_api_reference_en.pdf \
github repos: \
https://github.com/pfalcon/esp-open-sdk
The Nodemcu board purpose is mostly to work as a facilitator for the
use of the esp8266 chip.
# GPG
sources: https://egel.github.io/2020/08/10/create-the-revocation-certificate-for-you-gpg-key.html \
https://www.devdungeon.com/content/gpg-tutorial \
https://ryanlue.com/posts/2017-06-29-gpg-for-ssh-auth \
https://oguya.ch/posts/2016-04-01-gpg-subkeys/ \
https://opensource.com/article/19/4/gpg-subkeys-ssh-multiples \
https://gist.github.com/fijimunkii/54089bce9af6a68fd75536496cba6030 \
https://unix.stackexchange.com/questions/31996/how-are-the-gpg-usage-flags-defined-in-the-key-details-listing \
https://www.saminiir.com/establish-cryptographic-identity-using-gnupg/