Skip to content

Instantly share code, notes, and snippets.

View shaposhnikoff's full-sized avatar
🏠
Working from home

Shaposhnikoff shaposhnikoff

🏠
Working from home
View GitHub Profile
@shaposhnikoff
shaposhnikoff / duration
Created November 19, 2014 17:45
duration
#!/bin/bash
echo 'select m_url,TIMESTAMPDIFF(SECOND, m_startTime, m_endTime) as time from sitramun2observer_FileCamera order by TIMESTAMPDIFF(SECOND, m_startTime, m_endTime) ;' | mysql -proot octopus > files.txt
while read line
do
echo ""
echo "Duration from database" `echo $line|awk '{print $2}'` "sec"
/opt/ffmpeg/ffprobe -v error -show_format -of flat=s=_ `echo $line|awk '{print $1}'` | egrep 'filename|duration'
echo ""

Encrypted root filesystem on Debian Wheezy

This documents how to set up an encrypted root filesystem (except for /boot) on Debian Wheezy with automatic mounting using a keyfile on a USB drive.

Basic setup

In the Debian Installer, choose "Guided - use entire disk and set up encrypted LVM". That's it, on boot you will be asked to enter you passphrase using the keyboard. My system does not usually have a keyboard attached, so that's not very convenient (but read on).

#!/bin/bash
# Собираем сервер
mkdir tmp
cd tmp
wget -c http://nginx.org/download/nginx-1.7.6.tar.gz
tar xzvf nginx*
git clone https://github.com/arut/nginx-rtmp-module.git
cd nginx-1.7.6
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
---
- digital_ocean: >
state=present
command=ssh
name={{ digitalocean.sshkeyname }}
ssh_pub_key="{{ digitalocean.sshkey }}"
client_id={{ digitalocean.clientid }}
api_key={{ digitalocean.apikey }}
- digital_ocean: >
#! /bin/bash -x
VBR="2500k"
FPS="30"
QUAL="medium"
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"
SOURCE="rtsp://xxx.xxx.xxx:554/Streaming/Channels/1"
KEY="xxxxxxxxxxxxxxxx.xxx-xxx-qms4-emuc"
#ffmpeg \
#!/bin/bash
current_usage=$( df -h | grep '/dev/root' | awk {'print $5'} )
max_usage=30%
DATE=`date +%Y-%m-%d_%Hh%Mm%Ss`
DIR="/srv/ftp"
echo "--- add sinc ---"
msmctl add sink cam5-mjpeg/704576/archive1 format=mp4 url=$DIR/cam5-640x480.mp4
application myapp {
## exec_record_done /bin/ffmpeg -y -i $path -acodec libmp3lame -ar 44100 -ac 1 -vcodec libx264 $dirname/$basename.mp4;
live on;
hls on;
hls_path /opt/nginx-rtmp/hls_cam;
hls_fragment 30s;
hls_playlist_length 600s;
hls_continuous on;
record_suffix -%d-%b-%y-%T.flv;
@shaposhnikoff
shaposhnikoff / 32 ffmpeg_files
Last active August 29, 2015 14:16
ffmpeg testing
ffmpeg -t 60 -i Film.o.filme.avi -c:v libx264 -b:v 1128k -maxrate 1256k -bufsize 2000k -vf scale=90:86 -an -f flv rtmp://msm-flex.sis.lan/octopus/1 &
ffmpeg -t 60 -i Film.o.filme.avi -c:v libx264 -b:v 1128k -maxrate 1256k -bufsize 2000k -vf scale=90:86 -an -f flv rtmp://msm-flex.sis.lan/octopus/2 &
ffmpeg -t 60 -i Film.o.filme.avi -c:v libx264 -b:v 1128k -maxrate 1256k -bufsize 2000k -vf scale=90:86 -an -f flv rtmp://msm-flex.sis.lan/octopus/3 &
ffmpeg -t 60 -i Film.o.filme.avi -c:v libx264 -b:v 1128k -maxrate 1256k -bufsize 2000k -vf scale=90:86 -an -f flv rtmp://msm-flex.sis.lan/octopus/4 &.
ffmpeg -t 60 -i Film.o.filme.avi -c:v libx264 -b:v 1128k -maxrate 1256k -bufsize 2000k -vf scale=90:86 -an -f flv rtmp://msm-flex.sis.lan/octopus/5 &
ffmpeg -t 60 -i Film.o.filme.avi -c:v libx264 -b:v 1128k -maxrate 1256k -bufsize 2000k -vf scale=90:86 -an -f flv rtmp
@shaposhnikoff
shaposhnikoff / rpm-from-source.sh
Last active August 29, 2015 14:27 — forked from fernandoaleman/rpm-from-source.sh
How to create an RPM from source with spec file
# How to create an RPM from source with spec file
# This is for Redhat versions of linux. Sometimes when you search for an rpm package,
# it is either outdated or not available. The only thing available is the source code.
# You can create a custom RPM package from source.
#
# For this example, I'll be using the latest version of Git, currently v.1.7.7.3
# Step: 1
# Install rpmbuild