Skip to content

Instantly share code, notes, and snippets.

@jr-k
jr-k / docker-compose.yml
Last active July 19, 2024 00:28
Complete media center based on Plex + Sonarr + Radarr + Jackett + Transmission + Ombi
version: "2.1"
services:
plex:
image: lscr.io/linuxserver/plex:latest
network_mode: host
container_name: plex2
devices:
- /dev/dri:/dev/dri
environment:
- PUID=1000
@jr-k
jr-k / ipenv
Created July 7, 2022 13:47
Replace private IP of .env file by your computer's one
#!/bin/bash
ip=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | grep 192.168 | cut -d\ -f2)
sed -E -i '' "s/192.168.[0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?/$ip/g" contentplayer-mobile/.env
echo "👻 Updated ip address on env file : $ip"
@jr-k
jr-k / sms-to-telegram.md
Created October 20, 2021 14:33 — forked from ethaniel/sms-to-telegram.md
HOWTO: Receive SMS via 4G/LTE Huawei stick on Raspberry Pi 4 and forward them via Telegram

HOWTO: Receive SMS via 4G/LTE Huawei stick on Raspberry Pi 4 and forward them via Telegram

I live abroad and have only 1 sim card slot in my phone. It holds the SIM card of the country that I am in right now. But I also have another SIM card from my home country which receives my banking SMS codes. I can't afford to lose the "home" SIM card, so I decided to keep it in my house and forward the SMS messages to my main phone and computer via Telegram (just like Whatsapp, but so much better).

I also made a choice to use a 4G/LTE stick instead of 3G, because the 3G signal in my area is getting worse in worse due to operators upgrading their equipment.

Prerequisites

  1. Raspberry Pi 4
  2. Huawei E8372 (but can be any similar)

Step 1 - Get the Huawei card to work properly with Raspberry

@jr-k
jr-k / esphome-print-async.py
Created April 17, 2020 14:54 — forked from fpletz/esphome-print-async.py
aioesphomeapi minimal examples
#!/usr/bin/env python3
import aioesphomeapi
import asyncio
async def main():
loop = asyncio.get_running_loop()
cli = aioesphomeapi.APIClient(loop, "foobarhostname", 6053, "foobarpassword")
await cli.connect(login=True)
@jr-k
jr-k / .python-gsmmodem-advanced.md
Created February 28, 2020 01:59 — forked from stevecohenfr/.python-gsmmodem-advanced.md
Read long SMS with python-gsmmodem (and send SMS with same running script)

Read long SMS with python-gsmmodem (and send SMS with same running script)

I spend a lot of time to replace gammu with python-gsmmodem for my Huawei E3531.

The python exemple is just an exemple, it's incomplete. It does not read sms in the memory (if you receive a sms before starting the script). And it does not concat multiple parts sms (it will print unordered parts).
Also, as your live read sms script is running, you cannot send sms with another script because the dongle is busy.

Here is my own script to read all kind of SMS and send in same time.

@jr-k
jr-k / README.md
Created January 5, 2020 16:17 — forked from mrbar42/README.md
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
@jr-k
jr-k / gist:5a1e27884e6b6cc2a30f3d8caefef8ee
Last active May 23, 2019 16:31
Convert seconds to display date in HH:MM:SS format
const secondsToHHMMSS = function(opts) {
const sec = opts.seconds;
const hrs = Math.floor(sec / 3600);
const min = Math.floor((sec - (hrs * 3600)) / 60);
let seconds = sec - (hrs * 3600) - (min * 60);
seconds = Math.round(seconds * 100) / 100;
let result = opts.hideHourIfZero && hrs == 0 ? '' : ((opts.leadingZeroHour && hrs < 10 ? "0" + hrs : hrs) + opts.minuteToSecondsSeparator);
@jr-k
jr-k / offlineFallback.py
Created January 27, 2019 18:12 — forked from Psychokiller1888/offlineFallback.py
A way to fallback to local services for Snips when your internet goes down
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import subprocess
import time
RUNNING = False
ONLINE = True
@jr-k
jr-k / readme.md
Created January 27, 2019 16:47 — forked from mowings/readme.md
ffmpeg stream and save video from Dahua 4300s IP Camera

Use ffmpeg to stream video from a dahua 4300s to a file or files

You can use ffmpeg to directly pull frames off of a dahua 4300s at full resolution. May be a good alternative to pricey dvrs which likely cannot record at full resolution, may not work with the camera, or are prohibitevly expensive

Simple Stream to file

Simple stream to file. Full resolution

ffmpeg -loglevel debug -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/live" \

-c copy -map 0 foo.mp4