Wildkamera AVI für Whatsapp ausgeben
Posted by wnf on Tuesday, 17 March 2020ffmpeg -i IMAG2476.AVI -c:v libx264 -c:a aac output.mp4
ffmpeg -i IMAG2476.AVI -c:v libx264 -c:a aac output.mp4
In einer meiner VMware-Maschinen (Kubuntu 18.04.2 LTS) lief das Programm unattended-upgr Amok mit einer Prozessorauslastung von 100%. Auch ein Neustart half da nichts. Hier steht beschrieben, wie dem Problem abgeholfen werden kann.
sudo dpkg-reconfigure -plow unattended-upgrades
Nach einem reboot war dann alles wieder gut.
Dieses Shell-Script löst die gleiche Aufgabe in der Konsole:
#!/bin/bash sudo apt update && sudo apt dist-upgrade sudo apt-get autoremove --purge sudo apt-get autoclean
Literatur
Zur Beachtung Unter Delphi 2009 funktioniert die unten angegebene Funktion testCert zwar, aber der Zugriff auf einen anderen Server lieferte nur 403 Forbidden. Unter Delphi 10 Tokyo funktioniert der Zugriff immer.
Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM
openssl pkcs12 -in zugang.p12 -out zugang.pem -nodes
in Delphi
uses SysUtils, Classes, Forms, IdHTTP, IdSSLOpenSSL, idGlobal, Controls, ComCtrls, ToolWin, StdCtrls; function TForm1.testCert: boolean; var IdHTTP1 : TIdHTTP; Id_HandlerSocket : TIdSSLIOHandlerSocketOpenSSL; cert:string; s : string; begin try me.Clear; IdHTTP1 := TIdHTTP.Create( self ); IdHTTP1.Request.BasicAuthentication := False; IdHTTP1.Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0'; Id_HandlerSocket := TIdSSLIOHandlerSocketOpenSSL.Create( IdHTTP1 ); cert := 'zugang.pem'; Id_HandlerSocket.SSLOptions.CertFile := cert; (* PEM contain both CERT and Key *) Id_HandlerSocket.SSLOptions.KeyFile := cert; Id_HandlerSocket.SSLOptions.Mode := sslmClient; Id_HandlerSocket.SSLOptions.Method := sslvSSLv23; IdHTTP1.IOHandler := Id_HandlerSocket; me.Add( Id_HandlerSocket.SSLOptions.CertFile ); s := IdHTTP1.Get( 'https://www.scriptjunkie.us/auth/verifycert' ); me.Add( s ); Result:=True; finally Id_HandlerSocket.Free; IdHTTP1.Free; end; end;
Die beiden Dateien liste1.txt und liste2.txt wurden durch ein Windows-Programm erzeugt.
$ iconv -f ISO_8859-1 -t UTF-8 liste_1.txt > liste_1.utf $ iconv -f ISO_8859-1 -t UTF-8 liste_2.txt > liste_2.utf
$ diff liste_1.utf liste_2.utf | grep '^>' | sed -e 's/>//' > unterschiede.txt
Aus der Musiksammlung im Verzeichnis PATH werden 100 zufällige Titel abgespielt.
Als MP3-Player dient mpg123 (der natürlich vorher installiert werden muss)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # import os from glob import glob import random import subprocess PATH = '/wnfdaten/Musik/' def playMp3(path): subprocess.Popen(['mpg123', '-q', path]).wait() def allMp3s(): print(PATH) result = [y for x in os.walk(PATH) for y in glob(os.path.join(x[0], '**/*.mp3'))] return result def main(): alle = allMp3s() anz=0 while anz<100: dn=random.choice(alle) print(anz,dn) playMp3(dn) anz = anz +1 return anz if __name__ == '__main__': main()
Die vom Kunden gelieferte PDF-Datei soll verdoppelt werden. Dazu die Datei in ein leeres Verzeichnis kopieren und umbenennen.
$ cp 2015_VE_Komplett.pdf ./xxx/2015_VE_Komplett_1.pdf $ cp 2015_VE_Komplett.pdf ./xxx/2015_VE_Komplett_2.pdf
Mit pdftk die beiden Dateien verbinden.
$ pdftk ./xxx/*.pdf cat output ./xxx/xxx.pdf
Mit gs die erzeugte Datei verkleinern:
$ gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=./xxx/2015_VE_Komplett.pdf ./xxx/xxx.pdf
scanimage --format=pbm --resolution 300 -x 148 -y 210 > /tmp/scantopdf.pbm
pnmtops -equalpixels -dpi 300 -width 4 -height 8 /tmp/scantopdf.pbm > /tmp/scantopdf.ps
ps2pdf -dEPSCrop /tmp/scantopdf.ps /tmp/scantopdf_08.pdf
In meinem Backup-Script sichere ich seit langer Zeit meine Daten auf mybooklive.fritz.box (das ist mein NAS). Von einem Tag auf den anderen funktioniert das Script nicht mehr.
Kurzfassung der Lösung
AllowUsers root wnf bine
# chown wnf:share /shares/wnf
Woran kann das liegen?
Der Ping funktioniert
$ ping mybooklive.fritz.box PING mybooklive.fritz.box (192.168.1.6) 56(84) bytes of data. 64 bytes from mybooklive (192.168.1.6): icmp_req=1 ttl=64 time=0.197 ms $ ping mybooklive.local PING mybooklive.local (192.168.1.6) 56(84) bytes of data. 64 bytes from mybooklive (192.168.1.6): icmp_req=1 ttl=64 time=0.161 ms $ ping mybooklive PING mybooklive (192.168.1.6) 56(84) bytes of data.
Jetzt versuche ich mich per ssh auf MyBookLive anzumelden.
$ ssh root@mybooklive.fritz.box @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the RSA key sent by the remote host is 37:75:0e:15:12:78:30:55:11:fb:9b:aa:21:b4:df:05. Please contact your system administrator. Add correct host key in /home/wnf/.ssh/known_hosts to get rid of this message. Offending RSA key in /home/wnf/.ssh/known_hosts:7 remove with: ssh-keygen -f "/home/wnf/.ssh/known_hosts" -R mybooklive.fritz.box RSA host key for mybooklive.fritz.box has changed and you have requested strict checking. Host key verification failed.
Ja, wenn der ssh-Zugriff auf MyBookLive nicht mehr funktioniert, dann kann die Datensicherung natürlich auch nicht mehr funktionieren.
Also wie angegeben den alten Schlüssel entfernen:
$ ssh-keygen -f "/home/wnf/.ssh/known_hosts" -R mybooklive.fritz.box /home/wnf/.ssh/known_hosts updated. Original contents retained as /home/wnf/.ssh/known_hosts.old
Und dann beim Anmelden per ssh wieder herstellen:
wnf@c2012:~$ ssh root@mybooklive.fritz.box The authenticity of host 'mybooklive.fritz.box (192.168.1.6)' can't be established. RSA key fingerprint is 37:75:0e:15:12:78:30:55:11:fb:9b:aa:21:b4:df:05. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'mybooklive.fritz.box' (RSA) to the list of known hosts. Warning: the RSA host key for 'mybooklive.fritz.box' differs from the key for the IP address '192.168.1.6' Offending key for IP in /home/wnf/.ssh/known_hosts:4 Are you sure you want to continue connecting (yes/no)? yes root@mybooklive.fritz.box's password:
Als normaler User kann ich mich immer noch nicht anmelden. Bei der Kontrolle der Datei /etc/ssh/sshd_config auf MyBookLive fiel mir auf, dass in der Zeile
AllowUsers root
die anderen Benutzer fehlten
AllowUsers root wnf bine
außerdem
#AuthorizedKeysFile %h/.ssh/authorized_keys
ändern in
AuthorizedKeysFile %h/.ssh/authorized_keys
Also die Datei bearbeiten und vom sshd neu einlesen lassen:
# nano /etc/ssh/sshd_config MyBookLive:/# /etc/init.d/ssh reload
Und es funktioniert immer noch kein Einloggen ohne Passwort.
Deshalb als root auf mybooklive einloggen und die Meldungen aus /var/log/sshd.log anzeigen:
# egrep -i 'ssh.*wnf' /var/log/sshd.log May 3 15:02:59 MyBookLive sshd[7320]: Authentication refused: bad ownership or modes for directory /shares/wnf May 3 15:02:59 MyBookLive sshd[7320]: Authentication refused: bad ownership or modes for directory /shares/wnf
Kontrolle wer das Homeverzeichnis besitzt:
# ls -l /shares/ drwxr-xr-x 17 nobody share 65536 Aug 26 2013 wnf
# chown wnf:share /shares/wnf # ls -l /shares/ drwxr-xr-x 17 wnf share 65536 Aug 26 2013 wnf
Und siehe da es funktioniert der passwort-lose zugriff auf mein NAS MyBookLive wieder.
Neuer Rechner neues Glück.
Das anmelden per ssh funktioniert nur per Passwort-Authentifizierung.
$ ssh-copy-id -i ~/.ssh/id_rsa.pub bine@mybooklive Warning: the RSA host key for 'mybooklive' differs from the key for the IP address '192.168.1.6' Offending key for IP in /home/bine/.ssh/known_hosts:3 Matching host key in /home/bine/.ssh/known_hosts:5 Are you sure you want to continue connecting (yes/no)? yes bine@mybooklive's password: sh: line 2: .ssh/authorized_keys: Keine Berechtigung
Login auf MyBookLive und dort die .ssh/authorized_keys löschen
rm .ssh/authorized_keys
wieder ausloggen und den Schlüssel erneut übertragen:
$ ssh-copy-id -i ~/.ssh/id_rsa.pub bine@mybooklive /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys bine@mybooklive's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'bine@mybooklive'" and check to make sure that only the key(s) you wanted were added. $ ssh mybooklive
Mit diesem Script kann ich von meinem Scanner aus eine PDF-Datei im Verzeichnis ~/PDF erzeugen. (Das Original stammt von www.svenna.de))
#!/usr/bin/perl
######################################################
# LIZENZ
#
# dieses programm steht unter der bierlizenz!
# du kannst es benutzen, veraender und kopieren, wie du willst.
# wenn wir uns mal treffen und du meinst es ist es wert - gib mir n bier aus :-)
# svenna
#
# scripts@svenna.de
# www.svenna.de
######################################################
# scanner erkennen
# dazu muss sane installiert sein
$scanner = `scanimage -L`;
# drucker erkennen
$printer = `lpq -P PDF`;
$printer = $1;
if ($scanner =~ /(\w+:libusb:\d{3}:\d{3})/){
$scanner = $1;
print "Scanner: $scanner\n";
print "Drucker: $printer\n\n";
copy();
}
else {print "Immer erst den Scanner anschliessen ;-) \n";}
sub copy {
print "scanne Dokument\n";
system("/usr/bin/scanimage -d $scanner --gray=yes --resolution 150 -x 210 -y 295 > /tmp/kopie.pbm");
print "wandle in PS-Datei um\n";
# dazu muss netpbm installiert sein
system("/usr/bin/pnmtops -equalpixels -dpi 150 -width 8 -height 11.6 /tmp/kopie.pbm > /tmp/kopie.ps");
print "schicke Kopie an Drucker\n";
system("/usr/bin/lpr -P$printer /tmp/kopie.ps");
print "Kopie wurde im Ordner ~/PDF erstellt\n";
}