Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

2016-01-10

Changing frame rate and frame size using avconv


To get info abaut video file content:
$ avprobe <file>

* .mp4 files


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './video_fps60.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.19.100
  Duration: 01:41:19.63, start: 0.000000, bitrate: 4427 kb/s
    Stream #0.0(und): Video: h264 (Main), yuv420p, 1280x720, 4285 kb/s, 59.94 fps, 90k tbn, 119.88 tbc
    Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, fltp, 125 kb/s

Did not allow keep aac audio codec:
encoder 'aac' is experimental and might produce bad results.
Add '-strict experimental' if you want to use it.

So I change it to ac3, set 2 audio chanels and 4 threads cause my CPU i5, I have 4 cores available:

$ avconv -i video_fps60.mp4 -threads 4 -r 24 -acodec ac3 -ac 2 video_fps24.mp4

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './video_fps24.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.20.4
  Duration: 00:01:24.33, start: 0.000000, bitrate: 3246 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1280x720, 3053 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc
    Stream #0.1(eng): Audio: ac3, 44100 Hz, stereo, fltp, 191 kb/s


* .mkv files


Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (aac -> libvorbis)
  Stream #0:2 -> #0:2 (? -> ass)
Error while opening encoder for output stream #0:2 - maybe incorrect parameters such as bit_rate, rate, width or height

First stream is video, second audio, I don't event know what the third stream is, i guess i don't need it. So I use map, to specify only streams I want to include.

$ avconv -i video_fps60.mkv -map 0:0 -map 0:1 -threads 4 -r 30 video_fps24.mkv

$ avconv -i video_fps60.mkv -map 0:0 -map 0:1 -s 480x800 -threads 4 -r 24 video_fps24.mkv

From 4.3 GB file I get  3.6 GB (30 fps ) and  1.9 GB (480x800 and 24 fps).

To see all supported codecs
$ avconv -codecs













2015-10-10

Update Linux Kernel on Mint or Ubuntu


for upgrade you need three packages, depending on you architecture:

linux-headers ... ... ... amd64.deb
linux-headers ... ... ... all.deb
linux-image   ... ... ... amd64.deb

if you use Ubuntu based Linux distro, you can pick one of these: 


for example:

$ sudo update-grub


If for some reason you want to downgrade the kernel, it loads the newest kernel by default, so just uninstall new one (three packages that I mentioned) and it will load second on the list after reboot. Make sure you have at least one kernel installed! :)




2015-10-02

GIT ANNEX on RASPBIAN JESSIE

https://github.com/tradloff/git-annex-RPi

Problem:

git-annex: error while loading shared libraries: libgnutls.so.26: cannot open shared object file: No such file or directory
fatal: 'annex' appears to be a git command, but we were not
able to execute it. Maybe git-annex is broken?

Solution:

sudo ln -s /usr/lib/arm-linux-gnueabihf/libgnutls.so /usr/lib/arm-linux-gnueabihf/libgnutls.so.26


2015-09-19

QT UI for youtube-dl








Downloads

There is some obvious things should be fix'ed, but is't usable right now... and more convenient then terminal.

 



2015-06-27

Linux Mint 17 on Laptop Acer Aspire-E5-571G PART4



  • Using Microphone

Run 
$ alsamixer 
Press F6 select sound card...  Set Mic Boost to 20 and disable Auto-Mute M (use arrow buttons)




Check audio device for capture audio from mic, by

$ cat /proc/asound/devices

  1:        : sequencer
  2: [ 0- 8]: digital audio playback
  3: [ 0- 7]: digital audio playback
  4: [ 0- 3]: digital audio playback
  5: [ 0- 0]: hardware dependent
  6: [ 0]   : control
  7: [ 1- 0]: digital audio playback
  8: [ 1- 0]: digital audio capture
  9: [ 1- 0]: hardware dependent
 10: [ 1]   : control
 33:        : timer

Try record for 20 seconds

arecord -f cd -D hw:1,0 -d 20 test.wav

It worked for me, I able to hear myself. 

Graphical "Sound Preferences" looks like not handle the device properly. To use mic with graphical apps you probably have to select the capture device manually.

  





2015-06-13

Internet connection sharing with Raspberry Pi via Ethernet

My laptop is connected to internet via WiFi and I want to connect raspberrypi via Ethernet cable. I want to be able connect to raspberrypi via ssh and I also want for raspberrypi to be able access the internet. I have basic understanding about networks. And I think this task should event easier then setup a router. Bud it is not! Unless you know exactly what to do! You can find tips with a million terminal commands... You  can study advanced networks... bridging or nat and then run dhcp server... If you running a server this is all great! On a laptop you do not need all this...


Click Edit!

Change to "Shared to other computers"



Just my local network connection information, no voodoo magic!

First time I set this up! It did not work! Solution is: RESET laptop after configuration is done!

To find out raspberrypi IP:

rolas@Aspire-E5-571G ~ $ cat /var/lib/misc/dnsmasq.leases
1434209461 b8:27:eb:75:89:01 10.42.0.79 raspberrypi ff:eb:75:89:01:00:01:00:01:1c:dd:60:6a:b8:27:eb:75:89:01


https://www.youtube.com/watch?v=ZK-JHfJqmkY

2015-05-14

Changing password on Linux


If You set password only once during the installation and later on decided to change your password it can be confusing. What you have to know is during installation it sets the same password for your user and for root.

For example you enter the same password when you install some thing as root:

$ sudo apt-get install audacious         

and  when connecting to your machine via ssh as user:

$ ssh user@192.168.0.101

If you want to keep it that way with new password, you have to change it for both user and root:

$ sudo passwd
$ passwd

If you wondering what is a good password , check this link:

https://blog.kaspersky.com/password-check/

After playing with this site a come to conclusion that it can be two types of good passwords:

  • relativity short password (9 characters) containing combination of  lower case letters, capital letters,  numbers and symbols. What could be harder to remember.
  • longer password (18 characters) containing only lower case Latin letters, but in this case You can use sentence in foreign language. It can be much easier to remember. Perhaps you can use a bit longer sentence in English as well.    




2015-05-02

Linux Mint 17 on Laptop Acer Aspire-E5-571G PART3

Automatic brightness control very very annoying, it dims down almost random, so you have to set it couple times...


To disable improper automatic brightness control, uncheck this:




To control brightness manually from 0% to 100% , install xbacklight

$ sudo apt-get install xbacklight

Don't know how to overwrite functional keys for brightness, so I made two new shortcuts for brightness control, with commands:

$ xbacklight -inc 5
$ xbacklight -dec 5

For non 60 fps videos, mplayer works pretty well with this config:

$ cat ~/.mplayer/config
# Write your default config options here!

vo=gl_nosw
af=equalizer=0:-1:-2:-3:-4:-4:-3:-2:-1:0
cache=8192
cache-min=4
nosub=1
framedrop=1












2015-02-15

GIT ANNEX

  • Installing latest git version

https://launchpad.net/~git-core/+archive/ubuntu/ppa

$ sudo add-apt-repository ppa:git-core/ppa

$ apt-get update && apt-get --only-upgrade install git

$ apt-get install git-annex
 
$ git --version
git version 2.3.0

$ git annex version
git-annex version: 5.20140412ubuntu1

https://git-annex.branchable.com/walkthrough/


  • Git-annex binary for Raspberry-pi


https://github.com/tradloff/git-annex-RPi

  • Windows version


https://downloads.kitenet.net/git-annex/windows/current/
















2015-02-14

Installing Texmaker

http://www.xm1math.net/texmaker/index.html
  • Linux

$ sudo apt-get install texlive-full texmaker

To see the result press F6 to convert  and then press blue arrow next to "View PDF".

  •   Windows

http://www.howtotex.com/howto/installing-latex-on-windows/


  • Gray background with white letters

\documentclass{article}
\usepackage{xcolor}

\pagecolor[rgb]{0.15,0.15,0.15}
\color[rgb]{1,1,1}
\begin{document}

Hello \clearpage
World

\end{document}


2015-01-17

Linux Mint 17 on Laptop Acer Aspire-E5-571G PART2

Linux Mint 17 on Laptop Acer Aspire-E5-571G PART1
  • Nvidia driver

I added this PPA
https://launchpad.net/~xorg-edgers/+archive/ubuntu/ppa
And install Nvidia-343 driver
I find out that prismusrun is alternative to optirun
  • Avoiding Video tearing while watching 60 fps video

VLC useless
Mplayer works only with Intel vaapi
$ export VDPAU_DRIVER=va_gl &&  mplayer -cache 8192 file.mkv 
XBMC kodi can use both Nvidia or Intel vaapi (default)
$ prismusrun kodi
$ kodi
Totem works with Nvidia
$ prismusrun totem
  • Gaming

I Instaled Wine1.7 and using prismus StartCraft II works!
$ prismusrun wine /path/to/StarCraft-II-Setup-enGB.exe
  • Resource

http://askubuntu.com/questions/305305/running-xbmc-on-bumblebee-nvidia
http://ubuntuforums.org/showthread.php?t=2121749
  • Note

Hard drive on this laptop is large 1TB, but not very fast. Thats why mplayer better works with bigger cache option. I came to conclusion that most of the lag is hard drive retailed. So I made a few more settings. Set swappiness to 1 (how to) ant added "noatime" to FSTAB.


2014-12-30

Linux Mint 17 on Laptop Acer Aspire-E5-571G


  • Power button

You have to press it just right, because if you press it to short or to long it wont work! It take some to figure it out... I thought my brand new laptop not working! It's not a big deal right now.


  • BIOS

Press F2 when you see Acer logo, enter BIOS
Change option:
 from "UEFI" to "legacy"


  • Install Mint 17 

Create Mint17 64bit bootable flash drive and connect to the laptop.
Set first boot device "USB flash drive".
Install Mint as usual.


  • Resource

This is what I dig out:
https://wiki.ubuntu.com/Bumblebee
http://outhereinthefield.wordpress.com/2014/12/21/linux-gaming-setup-part-2-software-configs-nvidia-binary-and-bumblebee-steam-and-playonlinux-howto/
https://wiki.manjaro.org/index.php?title=Configure_NVIDIA_%28non-free%29_settings_and_load_them_on_Startup
http://askubuntu.com/questions/128463/how-to-control-brightness

YES! The famous Linux with Nvidia Optimus Technology and two Graphic cards!
I saved some time on the research before buying, so now I can spend more time on installation... Sadly...
I guess if you want a powerful laptop it is a common hardware and it's a good price so I should not complain.


  • Nvidia non free driver

Add PPA for nvidia non free driver:
$ sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
$ sudo apt-get update
$ sudo apt-get install bbswitch-dkms bumblebee bumblebee-nvidia lib32gcc1
libc6-i386 libcuda1-331 libturbojpeg libvdpau1 nvidia-331 nvidia-current
nvidia-libopencl1-331  nvidia-opencl-icd-331 nvidia-settings primus primus-libs
screen-resolution-extra socat virtualgl virtualgl-libs glibc-doc vdpau-driver
primus-libs-ia32 virtualgl-libs-ia32 virtualgl primus nvidia-settings
nvidia-opencl-icd-331


  • Configure "bumblebee":


$ sudo pluma  /etc/bumblebee/bumblebee.conf

My configuration, I mark the changes:

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Configuration file for Bumblebee. Values should **not** be put between quotes

## Server options. Any change made in this section will need a server restart
# to take effect.
[bumblebeed]
# The secondary Xorg server DISPLAY number
VirtualDisplay=:8
# Should the unused Xorg server be kept running? Set this to true if waiting
# for X to be ready is too long and don't need power management at all.
KeepUnusedXServer=false
# The name of the Bumbleblee server group name (GID name)
ServerGroup=bumblebee
# Card power state at exit. Set to false if the card shoud be ON when Bumblebee
# server exits.
TurnCardOffAtExit=false
# The default behavior of '-f' option on optirun. If set to "true", '-f' will
# be ignored.
NoEcoModeOverride=false
# The Driver used by Bumblebee server. If this value is not set (or empty),
# auto-detection is performed. The available drivers are nvidia and nouveau
# (See also the driver-specific sections below)
Driver=nvidia
# Directory with a dummy config file to pass as a -configdir to secondary X
XorgConfDir=/etc/bumblebee/xorg.conf.d

## Client options. Will take effect on the next optirun executed.
[optirun]
# Acceleration/ rendering bridge, possible values are auto, virtualgl and
# primus.
Bridge=auto
# The method used for VirtualGL to transport frames between X servers.
# Possible values are proxy, jpeg, rgb, xv and yuv.
VGLTransport=proxy
# List of paths which are searched for the primus libGL.so.1 when using
# the primus bridge
PrimusLibraryPath=/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus
# Should the program run under optirun even if Bumblebee server or nvidia card
# is not available?
AllowFallbackToIGC=false


# Driver-specific settings are grouped under [driver-NAME]. The sections are
# parsed if the Driver setting in [bumblebeed] is set to NAME (or if auto-
# detection resolves to NAME).
# PMMethod: method to use for saving power by disabling the nvidia card, valid
# values are: auto - automatically detect which PM method to use
#         bbswitch - new in BB 3, recommended if available
#       switcheroo - vga_switcheroo method, use at your own risk
#             none - disable PM completely
# https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods

## Section with nvidia driver specific options, only parsed if Driver=nvidia
[driver-nvidia]
# Module name to load, defaults to Driver if empty or unset
KernelDriver=nvidia-331
PMMethod=auto
# colon-separated path to the nvidia libraries
LibraryPath=/usr/lib/nvidia-331:/usr/lib32/nvidia-331
#LibraryPath=/usr/lib/nvidia-current:/usr/lib32/nvidia-current
# comma-separated path of the directory containing nvidia_drv.so and the
# default Xorg modules path
XorgModulePath=/usr/lib/nvidia-331/xorg,/usr/lib/xorg/modules
#XorgModulePath=/usr/lib/nvidia-current/xorg,/usr/lib/xorg/modules
XorgConfFile=/etc/bumblebee/xorg.conf.nvidia

## Section with nouveau driver specific options, only parsed if Driver=nouveau
[driver-nouveau]
KernelDriver=nouveau
PMMethod=auto
XorgConfFile=/etc/bumblebee/xorg.conf.nouveau
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


  • Nvidia settings

It creates virtual X display, by default it ":8" , it is set on bumblebee.conf.

Generally speaking, to see nvidia-settings you have to trun ON the nvidia card and specify display.

$ optirun nvidia-settings -c :8



So now card is active until the tool is closed.


  • Using Nvidia GPU


Close the nvidia-settings tool and try this:

$ cat /proc/acpi/bbswitch
0000:03:00.0 OFF

Make bash use bumblebee and then check:

$ optirun bash
$cat /proc/acpi/bbswitch
0000:03:00.0 ON
$ optirun --status
Bumblebee status: Ready (3.2.1). X is PID 25018, 1 applications using bumblebeed.

Now you can do 3D math test using nvidia card:

$ glxspheres64
Polygons in scene: 62464
Visual ID of window: 0x20
Context is Direct
OpenGL Renderer: GeForce 840M/PCIe/SSE2
92.270035 frames/sec - 81.921028 Mpixels/sec




  • Fixing Brightness control (copied from ubuntu forum, link above):


I figured it out from different sites, it fixes backlight.
Run the following command in Terminal:
gksu pluma /etc/default/grub
then change
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"
GRUB_CMDLINE_LINUX="acpi_osi=Linux"
then save and run:
sudo update-grub
and then restart the system for changes to take effect.


  • Issues:


Video tearing using Nvidia card
I tested with mplayer, kodi (xbmc), vlc.
Common solution is in nvidia-settings/OpenGL set:
Sync to Vblank
Allow Flipping
Use Conformant Texture Clamping
Gues what! In my case, nvidia-settings don't have such options!



What should i do now..?
Also nvidia-settings tool shows wrong screen resolution. I try change it but nothing changed.

I checked directly manufacturer drivers at
http://www.geforce.com/drivers


Results:

Linux x64 (AMD64/EM64T) Display Driver - BETA
Version: 346.22 - Release Date: Mon Dec 08, 2014

Linux x64 (AMD64/EM64T) Display Driver
Version: 340.65 - Release Date: Mon Dec 08, 2014


I use older driver, it's probably the issue.
Unfortunately, I know how to install NVIDIA-Linux-x86_64-346.22.run file but only on single GPU hardware. I have no clue how to combined with bumblebee.
Update's in PPA are WELCOME! 
 
  • Intel graphic card

Mplayer2 and VLC uses "-vo vx" by default and I think it's CPU and it's not working well.
XBMC (kodi) loads intel vaapi driver and seems to works good!

To enable intel vaapi on Mplayer2
$ sudo apt-get install libvdpau-va-gl1

$ VDPAU_DRIVER=va_gl mplayer ./Video.mkv 
MPlayer2 2.0-701-gd4c5b7f-2ubuntu2 (C) 2000-2012 MPlayer Team
Cannot open file '/home/rolas/.mplayer/input.conf': No such file or directory
Failed to open /home/rolas/.mplayer/input.conf.
Cannot open file '/etc/mplayer/input.conf': No such file or directory
Failed to open /etc/mplayer/input.conf.

Playing ./Video.mkv.
[mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0
[mkv] Track ID 2: audio (A_AAC), -aid 0, -alang eng
[mkv] Will play video track 1.
Detected file format: Matroska
Load subtitles in ./Videos/
[VS] Software VDPAU backend library initialized
libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_35
libva info: va_openDriver() returns 0
Selected video codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [libavcodec]
Selected audio codec: AAC (Advanced Audio Coding) [libavcodec]
AUDIO: 44100 Hz, 2 ch, floatle, 128.0 kbit/4.54% (ratio: 16000->352800)
AO: [pulse] 44100Hz 2ch floatle (4 bytes per sample)
Starting playback...
VIDEO:  1280x720  59.940 fps    0.0 kbps ( 0.0 kB/s)
VO: [vdpau] 1280x720 => 1280x720 Planar YV12
[vdpau] Got display refresh rate 60.016 Hz.
[vdpau] If that value looks wrong give the -vo vdpau:fps=X suboption manually.
A: 552.9 V: 553.0 A-V: -0.000 ct:  0.000   0/  0  0% 24%  0.3% 0 0

  • Game on Wine

I add PPA for wine to get latest version:
$ sudo apt-add-repository ppa:ubuntu-wine/ppa
$ sudo apt-get update

$ optirun wine ./path/to/StarCraft-II-Setup-enGB.exe

Startcraft II shows "Battle.net" window and crashes after couple seconds, during installation processes.

  • Version summary

Linux Mint 17 MATE
Kernel: Linux Aspire-E5-571G 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC
2014 x86_64 x86_64 x86_64 GNU/Linux
optirun (Bumblebee) 3.2.1
wine-1.6.2
NVIDIA Driver Version 331.113
X Server Version:    11.0
                                The X.Org Foundation
                                1.15.1
NV-Control               1.29


Linux Mint 17 on Laptop Acer Aspire-E5-571G PART2

2014-12-15

Back to firmware writing! STM32, can use Open Source Tools for that?

It looks like the answer is "YES"!

First step would be setting up the tools and environment.


I followed this video



Then make notes for my self:

GNU Tools for ARM Embedded Processors

https://launchpad.net/gcc-arm-embedded

Open terminal at toolchain bin directory, and:


$ pwd 
/media/9c04SSDp1/stm32/gcc-arm-none-eabi-4_9-2014q4/bin

$ echo PATH=$PATH:/media/9c04SSDp1/stm32/gcc-arm-none-eabi-4_9-2014q4/bin

$ echo PATH=$PATH:/media/9c04SSDp1/stm32/gcc-arm-none-eabi-4_9-2014q4/bin >> $HOME/.bashrc

$ source $HOME/.bashrc


$ ./arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20141119 (release) [ARM/embedded-4_9-branch revision 218278]
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Actually there is a better way!

 







Add your path, for example mane looks like this:


/media/9c04SSDp1/stm32/gcc-arm-none-eabi-4_9-2014q4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games




Also make shure:






Eclipse IDE for C/C++ Developers
http://www.eclipse.org/downloads/

Eclipse CDT extensions for GNU ARM development
http://gnuarmeclipse.livius.net/blog/plugins-install/

I made a "hello world" project, and it compiles! Nice!

Stm32 discovery line Linux programmer
https://github.com/texane/stlink


I don't have hardware yet, so I can not test the results.
To be continued...



2014-11-21

RaspberryPi Home security (Home project)

Components:

  • RaspberryPi
  • old USB GSM modem stick ( unused, collecting dust in a drawer )
  • ordinary USB Webcam

Plan:

I have http server already running on  RaspberryPi.

I can communicate with Modem via minicom (/dev/ttyUSB0), so I will write a simple program that sends SMS using AT Commands.

I can get pictures from webcam , so I will put it, so it can be viewed on web.
Or even send to me via email.

I can access gpio, so I can detect if doors were open...
Or maybe I will connect a movement sensor to it (similar that one used in stairways, to turn the light on and off).


                                                  AWESOME!!!

 I will put more info later!





2014-10-04

Blank project error after Qt installation

 
cannot find -lGL 
error: collect2: error: ld returned 1 exit status 


Solution:

$ sudo apt-get install libgl1-mesa-dev



2014-09-29

Using rsync over ssh

rsync-ssh-download.bash
-----------------------------------------------------------------------
#! /bin/bash

# SOURCE
SSH_PORT=22
SSH_USER="userA"
SSH_HOST="192.168.0.5"
SSH_PATH="/home/userA/"
# DESTINATION
DST="/home/userB/backup/"
DST_CHOWN="userB"

SRC="${SSH_USER}@${SSH_HOST}:${SSH_PATH}"

CHECK_FAIL=0

    if [ ! -f "/usr/bin/ssh" ]; then
    echo "ssh not found!"
    CHECK_FAIL=1   
    fi

    if [ ! -f "/usr/bin/rsync" ]; then
    echo "rsync not found!"
    CHECK_FAIL=1
    fi
   
    if [ ! -f "/usr/bin/sshpass" ]; then
    echo "sshpass not found!"
    CHECK_FAIL=1
    fi
   
    if [ "$(id -u)" != "0" ]; then
    echo "not root"
    CHECK_FAIL=1
    fi
   
    if [ $CHECK_FAIL -eq 1 ];then
    exit 0
    fi

   
read -s -p "Enter SSH Password: " pswd
echo ""
echo "Connecting..."

/usr/bin/rsync --verbose --recursive --append --links --copy-dirlinks \
--hard-links --perms --executability --times --delete --chown=${DST_USER}:${DST_USER} \
 --rsh="/usr/bin/sshpass -p '${pswd}' ssh -p ${SSH_PORT} -o StrictHostKeyChecking=no -l ${SSH_USER}" $SRC  $DST

du ${DST}  --max-depth=0 --block-size=MB
echo "Complete"

-----------------------------------------------------------------------
rsync-ssh-upload.bash
-----------------------------------------------------------------------
#! /bin/bash

# SOURCE
SRC="/home/userB/backup/"
# DESTINATION
SSH_PORT=22
SSH_USER="userA"
SSH_HOST="192.168.0.5"
SSH_PATH="/home/userA/"
DST_CHOWN="userA"

DST="${SSH_USER}@${SSH_HOST}:${SSH_PATH}"

CHECK_FAIL=0

    if [ ! -f "/usr/bin/ssh" ]; then
    echo "ssh not found!"
    CHECK_FAIL=1   
    fi

    if [ ! -f "/usr/bin/rsync" ]; then
    echo "rsync not found!"
    CHECK_FAIL=1
    fi
   
    if [ ! -f "/usr/bin/sshpass" ]; then
    echo "sshpass not found!"
    CHECK_FAIL=1
    fi
   
    if [ "$(id -u)" != "0" ]; then
    echo "not root"
    CHECK_FAIL=1
    fi
   
    if [ $CHECK_FAIL -eq 1 ];then
    exit 0
    fi

du ${SRC}  --max-depth=0 --block-size=MB
   
read -s -p "Enter SSH Password: " pswd
echo ""
echo "Connecting..."

/usr/bin/rsync --verbose --recursive --append --links --copy-dirlinks \
--hard-links --perms --executability --times --delete --chown=${DST_USER}:${DST_USER} \
 --rsh="/usr/bin/sshpass -p '${pswd}' ssh -p ${SSH_PORT} -o StrictHostKeyChecking=no -l ${SSH_USER}" $SRC  $DST

echo "Complete"


 -----------------------------------------------------------------------




 

2014-09-17

Splitting merging and converting audio files on Linux is easy

I always try to avoid lossy audio formats but sadly it is not always possible.
Three days a week my trip to work takes about 75min x 2.
Radio some times annoy me.  May Car CD player supports only Audio disks.
So by now I have 35 of them...
Half of them is not music. I have documentary audio, vocabulary course, etc...
Depending on the mood, some times smart people talking, makes the time on the trip go faster... 
It's very inconvenient to manage CD while driving when you have more then 4. Also They scratch constantly... 
So I bought FM Modulator. It's not very expensive and it's a little bit better solution. My FM Modulator support only *.mp3 and *.wma formats.


Now instead of burning CD's, I make proper *.mp3 file to SD card.

It is gratifying that there is a graphical tools on Linux, that is really easy to use.

wavbreaker

soundconverter







Only one thing I do in command line is:

$ normalize-audio ./file.mp3

IMPORTANT: every time you convert file to lossy audio format, you always loose quality. So if you need final result to be for example *.mp3, make sure you converted only once!


 

2014-09-04

How should I call this?

 LAMP = Linux + Apache HTTP Server + MySQL relational database management system + PHP

???? = Linux + Lighttpd + Sqlite + PHP-cgi;
     

2014-08-20

Private MailBox on Raspberry Pi


Buy a domain "something.com" or "somethingelse.eu" or what ever.
For my domain name, I paid ~10 euro for a year.
I bought from http://www.serveriai.lt/
I assume that Raspberry Pi you already have. And You also have stable internet at home and you can access your network from outside it means external static IP or IP that changes very rarely.
 
If you thinking , why do I need this, there is a lot free mail accounts on google yahoo etc...
Don't ask me! I am gonna ignore you!

Installation:

# aptitude install lighttpd

# aptitude install postfix  

# aptitude install dovecot-core dovecot-imapd

download roundcube and extract to /var/www/

install by following instructions in
http://<yourDomainName>/roundcubemail/installer/

Configuration:

lighttpd have to be configured for php support, more info about it is in here

Add your domain name to:
$ sudo nano /etc/hosts
127.0.0.1    localhost <domanName>

Testing:

Make sure tcp ports are open:

# netstat -nat
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      lighttpd
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN    dovecot
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      postfix
 

For you to get mail's outside your local network, You have to open tcp port 25 for public in your router, but right after you open to public, definitely test you postfix configuration otherwise you can be banned for spam. 
Test is very easy:


http://www.mailradar.com/openrelay/


Adding user for mail:


# adduser <userName>
# usermod -a -G mail <userName>


If you want to add <firstName.lastName> do it like this:
 
# adduser --force-badname <firstName.lastName>


 




 

It's not super fast, but it fast enough for me to use it. I am still testing...  but I like it so far!




** Update **


You will be spammer by default unless your internet provider can help you and set "reversDNS" for you.

So now I have to decide, ether I change my internet provider and pay more money and than continue with mail box or spare some money and forget this idea.