ffmpeg -r 5 -b 1800 -i %03d-capture.jpg out.mp4
Робимо з серії JPEG-файлів відео-файл в Zoneminder
Все просто, r - кількість кадрів за секунду (можна глянути в налаштуваннях камери), -b - бітрейт (якість).
після апгрейду Ubuntu, F10 почало викликати контекстне меню
Жахлива незручність, яка нервувала щоразу коли треба було вийти з mc. 5 хвилин гугління і проблема вирішена.
mkdir -p ~/.config/gtk-3.0
cat<<EOF > ~/.config/gtk-3.0/gtk.css
@binding-set NoKeyboardNavigation {
unbind "<shift>F10"
}
* {
gtk-key-bindings: NoKeyboardNavigation
}
EOF
щоб mc пам'ятав директорію
Перейшовши з Fedora та Ubuntu стикнувся з незручністю при роботі в терміналі. mc собі пам'ятає свою поточну директорію, а bash свою. Нарешті сьогодні дійшли руки виправити це. Прописуємо в ~/.bashrc стрічку:
source /usr/share/mc/bin/mc.sh
витягуємо погоду з Yahoo Weather на Python'і
import re
import urllib
from xml.dom import minidom
from pprint import pprint
from datetime import datetime
WEATHER_URL = 'http://weather.yahooapis.com/forecastrss?w=%s&u=c'
WEATHER_NS = 'http://xml.weather.yahoo.com/ns/rss/1.0'
def weather_for_location(location_id):
url = WEATHER_URL % location_id
dom = minidom.parse(urllib.urlopen(url))
forecasts = []
for node in dom.getElementsByTagNameNS(WEATHER_NS, 'forecast'):
forecasts.append({
'date': node.getAttribute('date'),
'low': node.getAttribute('low'),
'high': node.getAttribute('high'),
'condition': node.getAttribute('text'),
})
ycondition = dom.getElementsByTagNameNS(WEATHER_NS, 'condition')[0]
ywind = dom.getElementsByTagNameNS(WEATHER_NS, 'wind')[0]
yatmosphere = dom.getElementsByTagNameNS(WEATHER_NS, 'atmosphere')[0]
yastronomy = dom.getElementsByTagNameNS(WEATHER_NS, 'astronomy')[0]
ydescription = dom.getElementsByTagName('description')[1].firstChild.data
patImgSrc = re.compile('src="(.*)".*/>')
return {
'current_condition': ycondition.getAttribute('text'),
'current_temp': ycondition.getAttribute('temp'),
'current_humidity': yatmosphere.getAttribute('humidity'),
'current_visibility': yatmosphere.getAttribute('visibility'),
'current_sunrise': yastronomy.getAttribute('sunrise'),
'current_sunset': yastronomy.getAttribute('sunset'),
'current_wind_speed': ywind.getAttribute('speed'),
'current_wind_chill': ywind.getAttribute('chill'),
'current_wind_direction': ywind.getAttribute('direction'),
'current_img': re.findall(patImgSrc, ydescription),
'forecasts': forecasts,
'title': dom.getElementsByTagName('title')[0].firstChild.data,
'guid': dom.getElementsByTagName('guid')[0].firstChild.data,
}
генератор ip-адрес на Python
цікавий код :)
from random import randint
def randip():
while True:
yield ".".join(str(randint(1, 255)) for i in range(4))
randip().next()
чистимо оперативну пам'ять в linux
перелік процесів відсортований по споживанні пам'яті
# ps -eo pid,ppid,rss,vsize,pcpu,pmem,cmd -ww --sort=rss
очищаємо кешовану пам'ять
# sync; echo 3 > /proc/sys/vm/drop_caches
Підписатися на:
Дописи (Atom)