Skip to content

Instantly share code, notes, and snippets.

Avatar

Marián Hello mauron85

  • Slovakia
View GitHub Profile
@mauron85
mauron85 / upddns.sh
Last active Feb 26, 2020
Easy update DNS via Cloudfare API
View upddns.sh
# Script from:
# https://postapocalyptech.com/posts/use_cloudflare_ddns/
# adjusted for OpenWrt's ash
# Running curl command and getting your IP address using akamai's service
# Store it in IPADDRNOW variable
IPADDRNOW=$(curl -s http://whatismyip.akamai.com/); \
# Using cat to read stored IP address and then putting it in STOREDIP variable
@mauron85
mauron85 / snapshot-curl.sh
Created Nov 1, 2019
Grab camera snapshot and upload to remote server
View snapshot-curl.sh
# Grab snapshot from camera and upload via HTTP post
post_url="https://myserver/upload.php?token="
camera_url="http://192.168.89.146/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C&user=guest&password=guest123"
start_hour=6
end_hour=18
now=$(date +"%Y-%m-%d-%H-%M-%S")
year=$(echo "$now" | awk -F'-' '{ printf "%s", $1 }')
month=$(echo "$now" | awk -F'-' '{ printf "%s", $2 }')
@mauron85
mauron85 / ffmosaic-iina.sh
Last active Dec 9, 2019
Create multicast stream of two ip camera streams side-by-side
View ffmosaic-iina.sh
#!/bin/bash
#Watch multicast stream of two ip camera streams side-by-side in IINA player
url="udp://239.0.0.1:1234?ttl=13&pkt_size=1317"
ffmpeg -loglevel panic -re \
-i "rtmp://camera1.lan/bcs/channel0_ext.bcs?channel=0&stream=2&user=guest&password=guest123" \
-i "rtmp://camera2.lan/bcs/channel0_ext.bcs?channel=0&stream=2&user=guest&password=guest123" \
-filter_complex "nullsrc=size=1280x480 [base]; \
View make_timelapse.php
<?php
$now = time();
$currentYear = date("Y", $now);
$currentMonth = date("m", $now);
$currentDay = date("d", $now);
$currentHour = date('G', $now);
$currentMinute = intval(date('i', $now));
@mauron85
mauron85 / camera.m3u
Last active Jan 18, 2020
Camera surveillance using vlc mosaic
View camera.m3u
#EXTM3U
#EXTINF:0,rtsp://camera1.lan/h264Preview_01_sub
rtsp://guest:guest123@camera1.lan/h264Preview_01_sub
#EXTINF:0,rtsp://camera2.lan/h264Preview_01_sub
rtsp://guest:guest123@camera2.lan/h264Preview_01_sub
#EXTINF:0,rtmp://camera1.lan/bcs/channel0_main.bcs
rtmp://camera1.lan/bcs/channel0_main.bcs?channel=0&stream=0&user=guest&password=guest123
#EXTINF:0,rtmp://camera2.lan/bcs/channel0_main.bcs
rtmp://camera2.lan/bcs/channel0_main.bcs?channel=0&stream=0&user=guest&password=guest123
#EXTINF:0,rtmp://camera1.lan/bcs/channel0_sub.bcs
@mauron85
mauron85 / cam2.php
Last active Oct 21, 2019
Serve newest camera jpg snapshot
View cam2.php
<?php
define('MIN_HOUR', 6);
define('MAX_HOUR', 18);
define('SNAPSHOT_DIR', 'cam');
define('SNAPSHOT_PATTERN', '/camera[0-9]*_([0-9]+)\.jpg/');
define('SECONDS_TO_CACHE', 660); // 11 minutes
define('PLACEHOLDER_TEXT', 'Stream is over for today. We will be back at 6:00am.');
$now = time();
@mauron85
mauron85 / maintenance.php
Last active Oct 21, 2019
Clear camera images older then x seconds
View maintenance.php
<?php
echo "maintenance...";
define("ONE_DAY_IN_SECONDS", 86400);
function delete_files_older_than($dir, $fileDateMask, $seconds, $now = NULL) {
if (is_dir($dir) === false) {
echo "Dir $dir doesn't exists\n";
return;
View record_cam.sh
ffmpeg -rtsp_transport tcp \
-analyzeduration 100000 -probesize 100000 \
-i rtsp://guest:guest123@192.168.89.146:554/h264Preview_01_main \
-f segment -segment_time 300 -segment_format mpegts \
-reset_timestamps 1 \
-strftime 1 \
-c copy \
-movflags frag_keyframe /mnt/sda2/rec/cam-%Y%m%d-%H%M%S.mp4
@mauron85
mauron85 / create_new_firmware.sh
Created Sep 8, 2019 — forked from tuyenld/Original_vs_Mod_Chip.md
2019-02-11-upgrade-flash-chip-tplink-tl-wr840n-4mb-to-8mb
View create_new_firmware.sh
set -e
flash_size_in_MB=8
sysupgrade_OpenWRT="openwrt-18.06.1-ramips-mt76x8-tl-wr840n-v5-squashfs-sysupgrade.bin"
art_file="upload_openwrt_art.bin"
boot_loader="upload_openwrt_mtd0.bin"
sysupgrade_OpenWRT_size=$(wc -c $sysupgrade_OpenWRT | cut -f 1 -d " ")
art_file_size=$(wc -c $art_file | cut -f 1 -d " ")
boot_loader_size=$(wc -c $boot_loader | cut -f 1 -d " ")
@mauron85
mauron85 / create_new_firmware.sh
Created Sep 8, 2019 — forked from tuyenld/Original_vs_Mod_Chip.md
2019-02-11-upgrade-flash-chip-tplink-tl-wr840n-4mb-to-8mb
View create_new_firmware.sh
set -e
flash_size_in_MB=8
sysupgrade_OpenWRT="openwrt-18.06.1-ramips-mt76x8-tl-wr840n-v5-squashfs-sysupgrade.bin"
art_file="upload_openwrt_art.bin"
boot_loader="upload_openwrt_mtd0.bin"
sysupgrade_OpenWRT_size=$(wc -c $sysupgrade_OpenWRT | cut -f 1 -d " ")
art_file_size=$(wc -c $art_file | cut -f 1 -d " ")
boot_loader_size=$(wc -c $boot_loader | cut -f 1 -d " ")
You can’t perform that action at this time.