roundcube dtc – main.inc.php was not found.Please read the INSTALL instructions

check permissions for main.inc.php
In case of DTC hosting this file should be readable by group dtcgrp

Posted in Uncategorized | Leave a comment

Arduino: USBasp permission denied

Add file:
/etc/udev/rules.d/99-USBasp.rules

SUBSYSTEM=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="uucp"

Then add your user to the uucp group.

And do

# udevadm trigger
Posted in Uncategorized | Leave a comment

Owncloud client installation Debian 8

The owncloud client in Debian 8 is too old from the Debian repositories, use the opensuse repository.

Add file: /etc/apt/sources.list.d/owncloud.list

deb http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Debian_8.0/ /

Install the key

wget http://download.opensuse.org/repositories/isv:ownCloud:desktop/Debian_8.0/Release.key
apt-key add - < Release.key
apt-get update

http://software.opensuse.org/download/package?project=isv:ownCloud:community&package=owncloud

Posted in Uncategorized | Leave a comment

search and replace string recursively in directories

text1 -> text2 from current dirctory and sub-directories:

find ./ -type f | xargs sed -i 's/text1/text2/g'

 

Posted in Uncategorized | Leave a comment

Convert space to underscore in filenames

rename "s/ /_/g" *
Posted in Uncategorized | Leave a comment

reorder files by renaming

To rename files the way this can list them: ls -lv

This is needed when for example you need to handle bunch of images named like:
1 front.jpg -> 0001.jpg
02.jpg-> 0002.jpg
3.jpg-> 0003.jpg
10.jpg-> 0004.jpg

Found somewhere in the net, working great. Just test with echo and remove echo when ready. Need to also fix the files with space in name.

#!/bin/bash
def=0000
for f in $(ls -v *.jpg);do
 ((cnt++))
 if [[ ! -e "${def:${#cnt}:${#def}}${cnt}.jpg" ]];then
 echo mv "${f}" "${def:${#cnt}:${#def}}${cnt}.jpg" #remove preceding echo if everything is fine
 fi
done
Posted in Uncategorized | Leave a comment

Linux rename files to lower case *.JPG *.jpg

rename 's/\.JPG$/.jpg/' *.JPG
Posted in Uncategorized | Leave a comment

Mp3 add silence beginning or end, Linux command line

To add silence at the beginning or at the end of an mp3 file, use “sox” with “pad”:

sox original.mp3 new.mp3 pad 2.5 0

This adds 2.5s of blank space at the beginning of the mp3 file, 0s at the end

Automate this for a batch of file, put results files in ./output folder:

for i in ./*.mp3; do sox $i output/$i pad 2.5 0; done

To remove part of the track, use “trim” “when to start” “when to end”. Example to keep only audio from 2.5s to 20s:

sox original.mp3 trimmedpart.mp3 trimmed 2.5 20

If you want to remove only some seconds at start, just put the second number higher than the actual duration of the track.

Make sure you installed libsox-fmt-mp3

Posted in Uncategorized | Leave a comment

headless remote browser screenshots

Source: http://jerel.co/blog/2010/10/using-firefox-on-a-headless-server-to-make-screenshots-of-websites

apt-get install xvfb firefox imagemagick
Xvfb :1 -screen 0 1280x960x24 &
DISPLAY=:1 firefox http://www.alain.fi &
DISPLAY=:1 import -window root -crop 622x948+68+71 -resize 600x400 -quality 90 /var/www/screenshots/screenshot.jpg
Posted in Uncategorized | Leave a comment

rename terminal

You can rename your terminal with this:

echo -ne "\033]0;My terminal name\007"
Posted in Uncategorized | Leave a comment