Home / Community / Blog

The easiest way to restore files from BackupPC is web interface, but if You are desperated to use command-line style You can try this:

su backuppc -c "/opt/BackupPC/bin/BackupPC_tarCreate -h myLaptop \
-n 23 -s / etc" > /tmp/etc.tar

where:

  • backuppc (after su) - name of user BackupPC is running as
  • /opt/BackupPC/bin - path where BackupPC is installed
  • myLaptop - name of host in BackupPC (usually DNS name)
  • 23 - backup number you want to restore (can be relative ex: -1)
  • / - is share name
  • etc - directory you want to restore (relative to share name)
  • /tmp/etc.tar - file with restored files

Of course usually You will compress this file:

su backuppc -c "/opt/BackupPC/bin/BackupPC_tarCreate -h myLaptop \
-n 23 -s / etc" | gzip > /tmp/etc.tgz

Detailed information on BacpupPC documentation page.

To list your hard drives you can use command:

wmic diskdrive list brief /format:list

...

I just found that I've wrote similar article some times ago:

I've tried to install virtual Linux on my second HDD (using optical bay adapter). To add physical drive you have to type command:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" \
internalcommands createrawvmdk -filename \
"C:\Users\jaqb\SP900.vmdk" -rawdisk "\\.\PhysicalDrive1"


(based on Using a raw disk as a VirtualBox drive in Windows 7 by Dan Fox) In my case I've to add full path to VBoxManage.

Then to install additional packages in CentOS 7 (using minimal installation) you have to manually enter full URL:

http://mirror.centos.org/centos/7/os/x86_64/

(How To Install CentOS 7 Via NetInstall)

You can control LEGO Power Function using Scrach as you can see on this video.

To achieve this follow these few steps:

  • Download S4A (Scratch For Arduino)
  • Download modified S4A firmware - 09 S4A LEGO IR Power Function.zip - I found it on this site.
  • Optionally: to test if your Arduino board work witch S4A you can check original S4AFirmware.
  • Extract files and copy three of them to directory named S4AFirmware14_LEGO_PF_IR:
    • S4AFirmware14_LEGO_PF_IR.ino
    • PowerFunctions.cpp
    • PowerFunctions.h
  • I've changed pin from D5 to D12 (it depends on hardware)

    int IR_pin = 12; // LEGO PF IR channel
    
  • Use Arduino (or similar software) tu compile and upload S4AFirmware14_LEGO_PF_IR.ino (during uploading you have to close S4A because it can interrupt communication)
  • Connect IR diode to pin (D12 in my case) - I've prepared simple board (in KiCAD) for Arduino Nano

Now You can make your first program:

it is a bit tricky: analog 5 mean "RED" channel and analog 6 mean "BLUE" one, values are

  • 0 - float
  • 1-7 forward (1-low, 7-fast)
  • 100 - break
  • 101-107 - reverse (101-low, 107-fast)

So this program does: FWD, wait 1s, Stop, wait 1s, REV, wait 1s, Stop, wait 1s for both channels/engines

Have fun!

I tried to monitor my flat using old phone as web camera (should be replaced with IP camera). It's quite simple using one of many Android apps (IP Webcam by Pavel Khlebovich in my case).

Since I do not have public IP I had to use OpenVPN to my home network:

My phone/camera has address 192.168.1.11 (Home LAN network). To have access to it from Internet, I had to add this to cameras.conf file (in /etc/httpd/conf.d directory):

<Location "/cam1">
        ProxyPass "http://192.168.1.11:8080/"
        ProxyPassReverse "http://192.168.1.11:8080/"
</Location>

Now I can see what is happening typing http://cameras.jaqb.gda.pl/cam1 in web browser.

What is worse anyone can see. To protect my own privacy I've added authentication, so whole file looks like this:

<VirtualHost *:80>
<Location "/cam1">
        ProxyPass "http://192.168.1.11:8080/"
        ProxyPassReverse "http://192.168.1.11:8080/"

        AuthType Basic
        AuthName "Acess to my first camera"
        AuthBasicProvider ldap
        AuthLDAPURL "ldap://localhost/dc=jaqb,dc=gda,dc=pl" NONE
        AuthLDAPBindDN "cn=administator,dc=jaqb,dc=gda,dc=pl"
        AuthLDAPBindPassword typeyourpasswordhere
        AuthLDAPGroupAttribute memberUid
        AuthLDAPGroupAttributeIsDN off
        Require ldap-user jakub
</Location>

</VirtualHost>

Now only user jakub (me ;-) can have access.

My ESP8266 devices are generating huge amount of logs so after some time LogAnalyzer database had over 5M records.

I've decided to delete old data, but before run purge script I want to backup these records.

The solution was quite simple:

mysqldump Syslog SystemEvents --where \
'FromHost LIKE "ESP" AND DATE(ReceivedAt) < "2018-01-01"' \
> /data/Dokumenty/Syslog-ESP-2017.sql

where Syslog is database, and SystemEvents is table.

You can also export to CSV (TSV) format if You prefer:

mysql -e "SELECT * FROM SystemEvents \
WHERE FromHost LIKE 'ESP' AND DATE(ReceivedAt) < '2018-01-01' \
INTO OUTFILE '/data/Dokumenty/Syslog-ESP-2017.csv' \
FIELDS TERMINATED BY '\t' ENCLOSED BY '\"' \
LINES TERMINATED BY '\n'" Syslog

After this I could delete whole year, instead of using script:

mysql -e "DELETE FROM SystemEvents \
WHERE FromHost LIKE "ESP" AND DATE(ReceivedAt) < '2018-01-01'" \
Syslog

Now I've only about 600k records ;-)

To allow backuppc user to send emails I've to change permissions to /etc/msmtprc file:

chmod a+r /etc/msmtprc

Now I can send email as backuppc, but there is a problem with logging:

root@NAS:~# sudo -u backuppc /usr/sbin/sendmail jaqb@mydomain.com
subject:test
from:backuppc@nas
this is a test

sendmail: cannot log to /var/log/frontview/msmtp.log: \
          cannot open: Permission denied
sendmail: log info was: host=mail.mydomain.com tls=on auth=on \
          user=jaqb from=jaqb@mydomain.com \
          recipients=jaqb@mydomain.com mailsize=90 smtpstatus=250 \
          smtpmsg='250 2.0.0 Ok: queued as E29FC1665F31' exitcode=EX_OK

(after "this is a test") you have to press Ctrl-D (end of file).

For identifying admin-permissions issues in desktop applications, ie. when everybody says to disable User Account Control (UAC), you can use LUA Buglight.

To enable acoustic fingerprinting in beets You have to install python acoustid library. My NAS uses Debian, so:

apt-get install python-acoustid

Now You can enable Chromaprint plugin (using beet config -e or directly editing ~/.config/beets/config.yaml file):

plugins: duplicates chroma

as you can see I have also enabled duplicate plugin.

Now if You run

beet fingerprint

You will get a lot of:

fingerprinting
fingerprint generation failed: audio could not be decoded

so I also installed:

apt-get install python-gi
apt-get install gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly
apt-get install ffmpeg libchromaprint-tools \
python-chromaprint libchromaprint0 gstreamer0.10-chromaprint \
libchromaprint-dev

but it doesn't work.

On the other hand fpcalc works.

I've installed the newest version:

wget "https://bitbucket.org/acoustid/chromaprint/downloads/chromaprint-fpcalc-1.4.1-linux-x86_64.tar.gz"
tar -xzf chromaprint-fpcalc-1.4.1-linux-x86_64.tar.gz
mv chromaprint-fpcalc-1.4.1-linux-x86_64 /usr/local/bin/
cd /usr/local/bin/
ln -s chromaprint-fpcalc-1.4.1-linux-x86_64/fpcalc

but still I've got the same error:

root@MyNAS:/tmp# beet import -W piosenka.mp3
fingerprinting of '/tmp/piosenka.mp3' failed: audio could not be decoded

/tmp/piosenka.mp3 (1 items)
No matching release found for 1 tracks.
For help, see: http://beets.readthedocs.org/en/latest/faq.html#nomatch
[U]se as-is, as Tracks, Group albums, Skip, Enter search, enter Id, aBort?

Nowadays if you want to clean up your MP3 collection instead of writing your own scripts You should better read about MusicBrainz/Picard, beets (witch Duplicates plugin) - they both (and VLC too!) use AcoustID.

You can also try, quite old, Echoprint/Server for the Echoprint.

When You use MS Windows, the best way to convert audio CD to MP3 (such program is also called grabber or ripper) is to use CDex - Open Source Digital Audio CD Extractor.

It's simple, uses GPL license and automatically fills MP3 Tags using CDDB (freedb.org) and/or local database. It also have portable edition (today only 1.77).

Just my blog...

Mon Tue Wed Thu Fri Sat Sun
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30