Skip to content

Instantly share code, notes, and snippets.

@mplinuxgeek
mplinuxgeek / video_stats
Created May 21, 2022 07:58
/usr/bin/video_stats
#!/bin/bash
shopt -s globstar nullglob dotglob
echo "Filename,Duration,Bitrate,Size (GB),Width,Height"
for f in **/*; do
if [ ! -d "$f" ]; then
mediainfo_general=$(mediainfo --Output="General;%Duration/String3%,%OverallBitRate/String%" "$f")
mediainfo_video=$(mediainfo --Output="Video;%Width%,%Height%" "$f")
file_size=$(ls -s --block-size=G "$f" | awk '{print $1}' | sed 's/[^0-9]*//g' )
echo "\"$f\",${mediainfo_general},${file_size},${mediainfo_video}"
fi
@mplinuxgeek
mplinuxgeek / recode_vaapi.sh
Last active August 31, 2020 14:07
This is a simple script that uses vaapi hardware acceleration to decode and encode videos.
#!/bin/bash
# Usage function, displays valid arguments
usage() {
echo "Usage: $(basename ${0}) [arguments] inputfile" 1>&2
echo " -q qp, defaults to 18 for near lossless quality, higher value = lower quality." 1>&2
echo -e "\nExample: $(basename ${0}) -q 22" 1>&2
exit 1
}
@mplinuxgeek
mplinuxgeek / Shell
Created April 28, 2020 14:46
Nemo enable copy/move to right click menu
gsettings set org.nemo.preferences context-menus-show-all-actions true
@mplinuxgeek
mplinuxgeek / not_a_real_file
Last active March 21, 2020 09:03
Home Assistant Python Virtual environment on Fedora 31
dnf update
reboot
firewall-cmd --add-port=8123/tcp --permanent
firewall-cmd --reload
sudo useradd -rm homeassistant -G dialout
cd /srv
sudo mkdir homeassistant
sudo chown homeassistant:homeassistant homeassistant
#include "Keyboard.h"
const int buttonPin = 4; // input pin for pushbutton
const int timePin = 10; // input pin for pushbutton
const int time_Ground = 16; // input pin for pushbutton
const int LED_Ground = 8; // input pin for pushbutton
const int LED = 9; // input pin for pushbutton
int previousButtonState = HIGH; // for checking the state of a pushButton
void setup() {
esphome:
name: alarm
platform: ESP8266
board: d1_mini
wifi:
ssid: ''
password: ''
web_server:
esphome:
name: wsleaf
platform: ESP8266
board: d1_mini
wifi:
ssid: ''
password: ''
mqtt:
esphome:
name: bedroom_light
platform: ESP8266
board: d1_mini
wifi:
ssid: ''
password: ''
web_server:
esphome:
name: magic_home_01
platform: ESP8266
board: esp01_1m
wifi:
ssid: ""
password: ""
# Change wifi output power (added in 1.14.3)
#output_power: 15dB
@mplinuxgeek
mplinuxgeek / iperf.service
Last active November 18, 2019 09:48
/etc/systemd/system/iperf.service
[Unit]
Description=iperf server
After=syslog.target network.target auditd.service
[Service]
ExecStart=/usr/bin/iperf -s
[Install]
WantedBy=multi-user.target