Skip to content

Instantly share code, notes, and snippets.

@mrbar42
mrbar42 / pdfer.sh
Last active April 2, 2018 11:11
Convert images to one combined PDF file (based on pdftk and imagemagic)
#!/usr/bin/env bash
set -e
if [[ ! "$1" ]]; then
echo "Usage: pdfer page1.png page2.png..."
exit 1
fi
output_file="combined.pdf"
@mrbar42
mrbar42 / README.md
Created November 28, 2018 17:28
How to open a Github issues like a pro

A Pro Example of a Github Issue

This issue is an overview about Github issues and their structure.

Detailed Description

There are many issues around software and development and many times despite a very good intention, the lack of information renders issues irrelevant and unaddressable.

This issue serves as an inspiration and as a practical example for info reach issue.

@mrbar42
mrbar42 / endless-logcat.sh
Last active May 2, 2021 09:56
Endless logcat on device (no terminal) with log rotation and convenience commands.
#!/usr/bin/env bash
set -e
case $1 in
help)
cat << EOF
Capture logcat endlessly inside the device.
This should be ran on a computer that is connected to an android device using adb.
Commands:
@mrbar42
mrbar42 / graceful.sh
Last active June 12, 2023 20:10
graceful exit for bash script with background children/subshells
#!/usr/bin/env bash
graceful_exit() {
# include this line: trap graceful_exit TERM INT HUP
echo "Exit requested..."
local timeout=${1:-4}
local list=""
for c in $(ps -o pid= --ppid $$); do
# request children shutdown
kill -0 ${c} 2>/dev/null && kill -TERM ${c} && list="$list $c" || true
@mrbar42
mrbar42 / README.md
Last active March 7, 2024 00:19
Install nodenv on Ubuntu

Installing nodenv on ubuntu

nodenv is a great tool, but its installation on Ubuntu is never smooth for me. Here are instructions to install nodenv along with node-build and node-aliases plugins.

ℹ️ note - nodenv recommands updating the PATH though not all programs run in a shell. i prefer adding symlinks to the nodenv binary and shims to make it available everywhere.

The script can be pasted into a terminal as is

# install the base app
@mrbar42
mrbar42 / README.md
Last active March 28, 2024 16:47
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@mrbar42
mrbar42 / README.md
Last active March 28, 2024 18:06
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster