Skip to content

Instantly share code, notes, and snippets.

View niemasd's full-sized avatar

Niema Moshiri niemasd

View GitHub Profile
@niemasd
niemasd / tsv_parse.c
Last active September 18, 2023 01:17
Parse TSV data loaded as a C string (char*)
// Compile: g++ -o tsv_parse tsv_parse.c
// Run: ./tsv_parse
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv) {
// example TSV dataset as C string
char* profile_data;
profile_data = (char*)"a\t1\nb\t2.3\nc\thello\n";
@niemasd
niemasd / download_m3u8.sh
Last active May 28, 2023 01:59
Download an M3U8 video stream and output it as an MKV using ffmpeg
#!/usr/bin/env bash
if [ "$#" -ne 2 ] ; then
echo "USAGE: $0 <m3u8_url> <out_file>"; exit
fi
base=$(echo "$1" | rev | cut -d'/' -f2- | rev)
curl -s $1 | grep -v "^#" | sed -e "s>^>$base/>" | xargs curl -s | ffmpeg -i pipe:0 -c:v copy -c:a copy $2