Wednesday, October 16, 2013

Search within text files by CLI

Open terminal in the target folder and run this command:

 grep -r <word> *

replacing <word>  with the needed expression.

Change the color font of Xfce desktop



Open home as root and ctrl-h to see hidden files.

Open .gtkrc.2.0 and add this:

style "xfdesktop-icon-view" {
XfdesktopIconView::label-alpha = 0

#Text colors you can delete if you want to use gtk theme colors
fg[NORMAL] = "#ffffff"
fg[SELECTED] = "#ffffff"
fg[ACTIVE] = "#0000ff"

}
widget_class "*XfdesktopIconView*" style "xfdesktop-icon-view"




-------------
 (via)

I have changed the original lines that made selected font green so that it will stay white.

Delete these lines to get back to the default theme-based colors.

Friday, October 11, 2013

Dual monitors shortkey settings

~via~

With LXRandr, one can save  a certain display configuration. Then, in order to find that, you need to know what has changed in the home folder:

find ~/ -mmin -5 -type f
 
You can change 5 to a smaller number if you wish.
In this way, after saving configuration in LXRandr and running this command, the last change recorded is in ~/.config/autostart/lxrandr-autostart.desktop. That's it.
To open that:

gedit ~/.config/autostart/lxrandr-autostart.desktop
 
It contains something like:

[Desktop Entry]
Type=Application
Name=LXRandR autostart
Comment=Start xrandr with settings done in LXRandR
Exec=xrandr --output LVDS --mode 1680x1050 --rate 60.1 --output VGA-0 --off
OnlyShowIn=LXDE 
 
What you need is (- with variable resolution - that is depending on my specific displays):
 
xrandr --output LVDS --mode 1680x1050 --rate 60.1 --output VGA-0 --off 

that is for the external monitor off, internal on.

To have the external on and the internal off:

xrandr --output LVDS --off --output VGA-0 --mode 1360x768 --rate 60.0 

To have extended monitor:

xrandr --output VGA-0 --auto --left-of LVDS 
 
Double desktop for a specific resolution for each display:

xrandr --output LVDS --mode 1680x1050 --rate 60.1 --output VGA-0 --mode 1360x768 --rate 60.0
 
To have the same display resolution on both:

xrandr --output LVDS --mode 1360x768 --rate 60.1 --output VGA-0 --mode 1360x768 --rate 60.0
 
or:
 
xrandr --output LVDS --mode 1680x1050 --rate 60.1 --output VGA-0 --mode 1680x1050 --rate 60.0
 
or lower:
 
xrandr --output LVDS --mode 1280x720 --rate 60.1 --output VGA-0 --mode mode 1280x720 --rate 60.0 


And for each you need to assign a key (that is done differently depending on the desktop environment).

Saturday, October 5, 2013

Use Nautilus actions to extract audio from video and more

Better than trying to add context menu commands to the minimalist Pantheon-Files of Elementary OS or to use other media applications to extract sound from video, I guess the most simple is just to install Nautilus (it is not at all problematic in eOS, contrary to Thunar, which comes with the whole Xfce environment).

 sudo apt-get install nautilus
also

 sudo apt-get install parallel


Then install Nautilus-Actions Configuration Tool and open it..

I will provide an example for extracting audio (aac in m4a container) from flv and mp4 video files.

Define a new action, give it a name, maybe an icon too. Check - 'Display action in selection context menu'.

 Use Context label: Extract as m4a






Under the command tab, add the command (the one that I use in Thunar - see the links in the question):

Path:
gnome-terminal
Parameeters:
 -e "parallel avconv -i '{}' -map 0:1 -c:a copy '{}.m4a' ::: %F"



Under Execution tab there are options to select depending on what you wan to see during and after the action (open terminal, report).

Under Basenames tab, enter the filters for the type of files in the context menu of which you want to see the command - in this case: *.flv and *.mp4.




There are other options, but these look sufficient for the purpose of my question.



Similar actions can be added to extract sound from other types of video and, of course for other very different purposes.

NOTE:
In fact the use of parallel is not necessary to select multiple files and process them:

avconv -i '{}' -map 0:1 -c:a copy '{}.m4a


will have the same result

Parallel has the theoretical advantage of processing one-by-one the selected file or to set the number of parallel processes.

Monday, June 10, 2013

Get any LibreOffice version

Older and new versions - HERE

Suggested here.

Even older versions, here. Suggested to me here.

Friday, June 7, 2013

Save icons position in Xfce

Save with:

sudo chattr +i ~/.config/xfce4/desktop/icons*
 
 
F5 TO RELOAD IF RESIZED 


OR LAUNCHER WITH 

xfdesktop --reload
 
 
--------------------------
 
If you need to reverse the lock on your icon placement run:

sudo chattr -i ~/.config/xfce4/desktop/icons*
 
 
FROM HERE 

Wednesday, June 5, 2013

Fix Romanian characters problem in Libreoffice

In Libreoffice the Romanian special characters from the default (linux) keyboard layouts (standard, comma) look odd - out of proportion with the other characters of the same word.

The ones that look ok, found in ro_cedilla and winkeys layouts, and those created in Windows, are signaled by Libreoffice as errors.

To remedy this,  install the Romanian cedilla dictionary.


From  answer to my askubuntu question received  here.




Friday, May 10, 2013

Extract audio from video file without change

The audio file contained should be the same format as the output. For flv and mp4 it is usually aac. But raw aac files can't contain metadata; to keep metadata from the original files better use m4a (which is just another name for mp4, but is fairly widely recognised by audio players) instead of aac as a file extension.

So:

the general formula is:
 
 avconv -i "INPUT FILE" -map 0:1 -c:a copy "OUTPUT FILE" 
 
For all files of the same type in a folder:

for mp4:

for i in *.mp4; do avconv -i "${i}" -map 0:1 -c:a copy "${i%.mp4}.m4a"; done


For flv:

for i in *.flv; do avconv -i "${i}" -map 0:1 -c:a copy "${i%.flv}.m4a"; done

Avi videos usually contain mp3:

for i in *.avi; do avconv -i "${i}" -map 0:1 -c:a copy "${i%.avi}.mp3"; done

(source

The disadvantage is that they cannot be added in Thunar custom actions as such. To add it, you should put it in a script, and run that from Thunar actions. A command that can be added as such and also works for all selected files (but should be limited to videos that contain `aac` files or to `aac` files as such) is:

gnome-terminal -e "parallel avconv -i '{}' -map 0:1 -c:a copy '{}.m4a' ::: %F"


To limit Thunar custom actions applications to `aac` and video containing this us Appearance conditions: make these settings (see here).

Replace accordingly for other input/output. 

UPDATE:

bash -c 'avconv -i "$0" -map 0:1 -c:a copy "${0%%.*}".m4a' %f

To see audio of the input video, use exiftools, avprobe or MediaInfo. More here.

Tuesday, April 30, 2013

Saturday, April 27, 2013

Add convert media command to Thunar Custom actions

To add convert commands to Thunar's custom actions or similar:


sudo apt-get install ffmpeg libavcodec-extra-53
 


Then, use such commands to add to Thunar custom actions:

ffmpeg -i %f %f.mp3

or

avconv -i %f %f.mp3 

To see it in a Terminal it should look like:

gnome-terminal --window-with-profile=new1 -e "avconv -i %f %f.mp3" 

(In Gnome Terminal, create a new profile called "new1" and edit it ('Edit/Profiles/Title and Command') to 'When command exits: Hold the Terminal open'.)

But in fact the new profile is not important, only that the terminal would close after the task is finished. Xfce-terminal can also be used in this case.

To convert multiple media files in Thunar, add this:

xfce4-terminal -e "parallel avconv -i '{}' '{}.mp3' ::: %F"

Can be used for converting video or audio files to different formats.


To just extract audio from video, without converting, first find the type of audio. Then use something like this - for flv and mp4, which contain aac audio which is to be contained as m4a:

xfce4-terminal -e "parallel avconv -i '{}' -map 0:1 -c:a copy '{}.m4a' ::: %F"
 
For webm video (ogg audio):

xfce4-terminal -e "parallel avconv -i '{}' -map 0:1 -c:a copy '{}.ogg' ::: %F".



 
 

Tuesday, March 26, 2013

INSYNC - Google drive client in Linux

It is still free in Linux.

Different versions here.

Like Dropbox, it associates with the file manager.

A Thunar-Xfce version here.

If it asks for thunarx-python, look around here.

For other versions, here.

Wednesday, March 20, 2013

Crossover: commercial Wine

Crossover is a commercial version of Wine. It has some advantages: installing Office and so on goes much smoother.

What it lacks is the customization of Wine.

- To make some customizations in Crossover:

  Go to Menu - Crossover - Run a Windows command, and, after selecting the corresponding 'bottle', enter 'regedit' (this would have to be done for each specific 'bottle')

  Navigate to and click on the following key: HKEY_CURRENT_CONFIG\Software\Fonts.

  Double-click on the "LogPixels" value.

  Change the base to "Decimal" and enter your desired font size.Note that the font size here isn't measured in standard "points"--the best way to get a size that's right for you is through cautious trial and error. Close the Registry Editor when you're done.

To enlarge the font of the menus, search for ' ~/.cxoffice/NAME_OF_BOTTLE/drive_c/windows/win.ini', open it in a text editor, add these two lines at the end, and save:
 
[Desktop]

MenuFontSize=18

Replace the "18" with whatever font size.

(This has to be done for each specific 'bottle' (which I guess is the equivalent of a wineprefix). Each program may have its own bottle which contains its own separate drive_c and windows folders. Customizations for a certain 'bottle' would have effect only for the programs installed in that bottle. 'Bottles' and the rest of CrossOver is installed in ~/.cxoffice.)

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

If file association is not ok, search in smth like, e.g. for Office, in '/.cxoffice/Microsoft Office 2007/desktopdata/cxmenu/StartMenu.C^5E3A^5Fusers^5Fcrossover^5FStart^2BMenu/Programs/Microsoft+Office/'; eventually save that script in a more convenient place and add it under Open with' option, 'custom command'.
 



Tuesday, March 19, 2013

Download subtitles with VLC

VLC has an addons/extension site: addons.videolan.org.


- put the file in the vlc subfile /lua/extensions, by default:
* Windows (all users): %ProgramFiles%\VideoLAN\VLC\lua\extensions\
* Windows (current user): %APPDATA%\vlc\lua\extensions\
* Linux (all users): /usr/lib/vlc/lua/extensions/
* Linux (current user): ~/.local/share/vlc/lua/extensions/
* Mac OS X (all users): /Applications/VLC.app/Contents/MacOS/share/lua/extensions/
(create directories if they don't exist)

VLSub: Search and download subtitles from opensubtitles.org using the hash of the video currently playing or its title. Also here.

Subtitle Finder: Get the subtitles of movies from the internet, currently only from OpenSubtitles.org (just displays subs, doesn't saves them; but sometimes finds much more subs).

Modified version to save subtitles here.

This extensions are better used at the same time.



Tuesday, February 19, 2013

Install multiple versions of Wine

Source here.

Install Playonlinux in Synaptic.

Tools -> Manage Wine Version -- Wine Versions tab; you can download and install different versions of Wine you need.

After that, install Windows applications you need, you can either download the apps from PlayOnLinux repository or manually install from installation file by clicking install a.pol package or an unsupported application and follow the steps.

After Windows application installations,  you can manage which Wine version to run which application on Tools -> Manage Wine Versions -- My Applications tab. Click the application and choose the Wine version on the drop box below it.

Install Office 2007 in Wine 1.5

Microsoft Office is for many people the one program that determines them to continue to use Windows.

(It used to be difficult to install Office, but not anymore. The problems appear with certain versions of Wine, but 1.5 is just fine with Office 2007. The idea is to keep oneself updated to the WineHQ instructions).

It is better to do this after a fresh installation of Wine 1.5 if already such scripts are installed. If not, be sure to have wine 1.5.

  • Install Wine 1.5
  sudo add-apt-repository ppa:ubuntu-wine/ppa
  sudo apt-get update
  sudo apt-get install wine1.5

  • Go to Menu/Wine/Configure Wine and make sure your version of wine is set to Windows XP.

  • Install Office 2007.
(Open the disk and right click on setup.exe and select "Open with wine windows program loader.")
The progress bar in the installer window may stop when it reaches about 2/3 of the way. The installation is continuing, even though the progress bar is not moving. Wait for it to finish.

After installation:
 
  • In the Menu/Wine/Configure Wine, under Libraries tab in the area labeled "New override for library" type in riched20.dll and click on Add.
You will see it appear in the list below. Now select the riched20 in the list that we just added and click on the Edit button.
Set it to Native (Windows) and click OK.
This will allow Powerpoint and the other applications to run correctly.

  • Better  install all fonts and improve appearance like here.

  • To install Office classic menus (which has nothing to do with Linux): not all such patches would work in Wine, but this does. 

See above WineHQ links for further issues.


Wednesday, January 23, 2013

How to create scripts

A script is a text file containing a command line that can be executed when the script is executed. So, the script file functions as an executable file for the command.

The general form of an executable script is

#!/bin/bash

the-command-line-here

If the command is meant to display an output in a terminal

#!/bin/bash

gnome-terminal -e "the-command-line-here"
But the terminal would close with the command and the output will not be seen. So, go to Edit -> Profile Preferences -> Title. Click the Command tab. Select Hold the terminal from the drop-down menu labelled When command exits.

Useful scripts:
  •  the printer status (outputs 2 numbers if ok)
#!/bin/bash

gnome-terminal -e "/etc/init.d/ccpd status"

Tuesday, January 22, 2013

Remove "People You May Know" in Facebook using Adblock rule



  •  In Firefox.
Install Adblock Plus
Go to its "Filter preferences" (ctrl-shift-F)
Under "Custom filers" - "Add Filter Group"
Rename the group and then to the right - Add filter

The filter to add is:

www.facebook.com##div[class="ego_section"]

  • The same filter can be added in Chrome with Adblock Plus.
  • With AdBlock (not "Plus") in Chrome: add the above line in Options/Customize, under "Manually edit your filters"

Thursday, January 17, 2013

Play internet video in external player

Most internet video cannot be played in external players. But some can.

As most such video is flash, the idea is to play them not  with the flash plugin, but with smplayer or vlc plugins.

Youtube is the most easy to play externally.
SMPlayer has an integrated Youtube Player (smtube) which has a search option.


But this is limited to youtube and the buffering has problems sometimes.

VLC behaves better and seems to be able to play other sources (at least Dailymotion, as far as I can tell). Copy video link and paste in Media - Open network stream.

To automate a bit this operation, add OpenWith addon to Firefox, go to its preferences and add VLC player there,  and then set it to appear in context menu.


 Then search something in Youtube or Dailymotion and in the list with findings right-click and open in VLC.






Monday, January 14, 2013

Remove Lubuntu notifier and replace with Xfce's



Replace Lubuntu's notification system with XFCE's, which won't queue up your notifications, like the default one does. To do that:

sudo apt-get install xfce4-notifyd
sudo apt-get remove notification-daemon
 
When doing it this way, it shouldn't ask to remove all those extra packages, as there will still be a notification system in place. I think it will still say it is uninstalling lubuntu-desktop, but that is because it is a meta package, meaning a package of packages. It won't remove your desktop. :-)

(THIS IS AN ASKUBUNTU ANSWER HERE)

Saturday, January 12, 2013

Add new commands in Thunar context menu

  • Edit/Configure custom actions.
  • Open a folder as root
Opening a root Thunar
Name: Open a root Thunar here
Command: gksu thunar %f
File pattern: *
Appears if selection contains: Directories
  • To add a command that would run a player, examples: 
/opt/deadbeef/bin/deadbeef %F
qmmp %F
/usr/bin/smplayer %f
/usr/bin/vlc %f

  • To lauch a Terminal:
exo-open --working-directory %f --launch TerminalEmulator

  • To open a root Thunar 
gksu thunar %N

  • To convert to png: 
convert %f %f.png

  • To convert pdf to text at this directory level: 
for file in *.pdf; do pdftotext "$file" "$file.txt"; done

  • convert pdf to txt in all directories : 
find . -name '*.pdf' -print0 | xargs -0 -n1 pdftotext

  • delete without recycle:
 rm -r %F

  • secure delete: 
(apt-get install secure-delete)

srm %F
  • shred, wipe:
shred -u %F

  • search with catfish: 
catfish --fileman=thunar –path=%f

  • to join selected text files 
cat %N > JoinedFile

  • To run in a Wine program: 
path/to/script %F

the script should look like:

(example for Foobar2000):

#!/bin/bash

cd ~/.wine/drive_c/"Program Files"/foobar2000/
if [ "$1" != "" ]; then
filename=`echo z:$1 | sed 's/\\//\\\\/g'`
wine foobar2000.exe "$filename" &
else
wine foobar2000.exe &
fi

Edit main menu items with MenuLibre



sudo add-apt-repository ppa:menulibre-dev/devel 
sudo apt-get update
sudo apt-get install menulibre

How to stop program from starting with the system.


Lubuntu's “lxsession-edit” (Desktop Session Settings) cannot add new programs at startup but can remove them.

There are programs that still run at startup without being displayed by this application.

So, go and delete them (their .desktop file) from /etc/xdg/autostart. Take also a look in /etc/xdg/lxsession/Lubuntu/autostart.

Mount point of virtual images

Using AcetoneISO, the path for mounting is /home/user/virtual-drives/1. In case the mount point is not automatically accessed, Acetone can be set to do that: go to File/Options/General options/File manager and select file browser (e.g., Thunar, after having installed it : in Lubuntu/LXDE I do not recommend Nautilus, but Thunar; selecting LXDE in that list seems useless.

Thursday, January 10, 2013

Problem with SMPlayer in Lubuntu

After installing Lubuntu, SMPlayer and Gnome Player would not work because mplayer is not installed yet, but a different application (a fork, mplayer2, with other dependencies).

So, before installing SMPlayer, it is better to get mplayer proper.


sudo apt-get purge mplayer2
sudo apt-get autoremove
sudo apt-get install mplayer gecko-mediaplayer gnome-mplayer

Then install SMPlayer in Synaptic and test it. If sound doesn't work  look in Preferences/General/Audio and switch audio between pulse/alsa.

Create swap after ubuntu installation

For newer version of ubuntu swap is very important. Question is why?

1. On hibernate system save all data from ram to swap.
2. When ram is full, swap is used as a secondary ram

Recently released ubuntu uses caching in ram. It's means save recently closed application data in ram, so that when you will use the application again it can load it quickly. Cache increase performance. For that ram becomes full (2GB or less). When ram fill with cache and system needs more ram it backup old cache in swap. If you don't have a swap then your system behave slow when ram is full.

What happen if you have already installed your system without swap partition? Fortunately ubuntu has option to create a swap as file.

Step 1: Allocate a file  sudo fallocate -l 2048m /mnt/swap_file.swap

Step 2: Change permission sudo chmod 600 /mnt/swap_file.swap

Step 3: Format the file for swapping device  sudo mkswap /mnt/swap_file.swap

Step 4: Add swap  sudo swapon /mnt/swap_file.swap

Step 5: Open fstab  sudo gedit /etc/fstab

Step 6: Add entry in fstab  /mnt/swap_file.swap none swap sw 0 0 


source : here

DeadBeef installation from a deb file

All versions in deb format: here.

Installing from deb seems preferable.

On  installing addons: here.

Launcher for Lubuntu: Synapse


sudo add-apt-repository ppa:synapse-core/ppa
sudo apt-get update
sudo apt-get install synapse

Can be used to search, launch, execute.

Ctrl-Space to run it.

Saturday, January 5, 2013

Record sounds (Deezer, etc) in separate tracks

sudo apt-add-repository ppa:osmoma/audio-recorder
sudo apt-get update
sudo apt-get install audio-recorder


or preferably

sudo apt-add-repository ppa:osmoma/audio-recorder -y && sudo apt-get update && sudo apt-get install audio-recorder -y

 or even better, if apt-fast is installed

sudo apt-add-repository ppa:osmoma/audio-recorder -y && sudo apt-fast update && sudo apt-fast install audio-recorder -y


Start recording while playing Deezer or any sound played by the computer.

If listening to an album and want to get files separated according to the silence between them uncheck the Add option, and then edit Timer, which is a matter of trial an error, and changes should be made from case to case.

A good start would be adding in any case 'start if sound', so that a new file should be created when sound starts; but in order to have a new file (different from the previous sound), first the recorder must be made to stop when there is no sound. 'stop if silence' is not a good option, as it creates a lot of small useless files; a better option is 'stop if silence 1 sec.'; and 'stop if silence 0.5 sec.' may also be a good option. (This should be enough for the stated purpose. Using audio threshold timer commands seems to me more complicated.)



The files are saved in ~/Audio.

Changing volume level during recording is a bad idea, because the recorded sound is distorted.