Linux:Bluetooth – Motorola S305 – way better sound or stereo :)

Re: Motorola S305 bluetooth headset

Go to System->Preferences and open the Sound panel. Select the "Hardware" tab and click on "Motorola S305", then you will see the choices for in the Profile menu at the bottom. In the Profile menu you can choose between HSP/HFP (telephony) or A2DP (stereo headphones). I discovered this by accident. I kept looking in the Bluetooth preferences but now that I see that setting here it makes sense.

 

 

 

Android: ANDROID_BIN which android unexpected error occured

$ ./create ~/projects/shoppingbuddy com.PortNumber53.ShoppingBuddy ShoppingBuddyAn unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
Deleting project…

 

nano create

Change the line:

ANDROID_BIN="${ANDROID_BIN:=$( which android )}"

to be the absolute path:

ANDROID_BIN="/home/mauricio/adt-bundle-linux-x86_64-20130219/sdk/tools/android"

 

 

Raspberry Pi: installing a LAMP server

Let's put the Raspberry Pi to good use:

 

1. Install Mysql

sudo pacman -S mysql

2. Start your server

# systemctl start mysqld

3. Secure your mysql installation

# /usr/bin/mysql_secure_installation

——————-

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 … Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 … Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 … Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 – Dropping test database…
 … Success!
 – Removing privileges on test database…
 … Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 … Success!

Cleaning up…

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

———————-

 

# nano /etc/mysql/my.cnf

 

[mysqld]

bind-address=127.0.0.1

 

 

Restart mysql

systemctl restart mysqld

 

 

================

Install PHP

 

pacman -S php php-apache libmcrypt libtool

 

nano /etc/php/php.ini

 

 

 

======================

 

nano /etc/locale.gen

enable:

en_US.UTF-8 UTF-8
en_US ISO-8859-1

 

save and generate your locales

# locale-gen

 

 

Install and Configure PostgreSQL

pacman -S postgresql

 

# mkdir -p /var/lib/postgres/data

# chown httpd:httpd -Rv /var/lib/postgres/

 

Configure Postgresql data dir

# su – postgres -c "initdb –locale en_US.UTF-8 -D '/var/lib/postgres/data'"

———————–

The files belonging to this database system will be owned by user "httpd".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

fixing permissions on existing directory /var/lib/postgres/data … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 24MB
creating configuration files … ok
creating template1 database in /var/lib/postgres/data/base/1 … ok
initializing pg_authid … ok
initializing dependencies … ok
creating system views … ok
loading system objects' descriptions … ok
creating collations … ok
creating conversions … ok
creating dictionaries … ok
setting privileges on built-in objects … ok
creating information schema … ok
loading PL/pgSQL server-side language … ok
vacuuming database template1 … ok
copying template1 to template0 … ok
copying template1 to postgres … ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and –auth-host, the next time you run initdb.

Success. You can now start the database server using:

    postgres -D /var/lib/postgres/data
or
    pg_ctl -D /var/lib/postgres/data -l logfile start
 

——————————————

 

Enable the service

# systemctl enable postgresql

Start if you want to use it before rebooting

# systemctl start postgresql

 

Raspberry Pi: mount flash disks at boot

Now that I got a little time to work on my Raspberry Pi, I decided to have 2 2GB flash drives mounted at boot to save some write cycles on the SD card:

After a few failed times, I googled for a while and the important bit is the 6th field in your /etc/fstab file. Here's mine:

 

[root@pi ~]# cat /etc/fstab
#
# /etc/fstab: static file system information
#
# <file system>        <dir>         <type>    <options>          <dump> <pass>
devpts                 /dev/pts      devpts    defaults            0      0
shm                    /dev/shm      tmpfs     nodev,nosuid        0      0
/dev/mmcblk0p1  /boot           vfat    defaults        0       0

/dev/sda1       /var       ext4    defaults          0       2
/dev/sda2       /data      ext4    defaults          0       2
/dev/sda3       /tmp       ext4    defaults          0       2
/dev/sdb1       /home      ext4    defaults          0       2

 

The "2" in the 6th field tells the kernel to wait for the drive to be available before trying to mount it.

Here's the "mount" command output:

/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=ascii,shortname=mixed,errors=remount-ro)
/dev/sdb1 on /home type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
/dev/sda2 on /data type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
/dev/sda3 on /tmp type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
/dev/sda1 on /var type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)

 

 

 

WordPress: Allowing contributors to upload media

 

This is the simplest way I found to allow for contributors to upload media on your WordPress blog:
 
Add this to the functions.php file in your current theme:
 
 
 
if ( current_user_can('contributor') && !current_user_can('upload_files') )
add_action('admin_init', 'allow_contributor_uploads');
 
function allow_contributor_uploads() {
$contributor = get_role('contributor');
$contributor->add_cap('upload_files');
}
 
 
 
 
source: http://wordpress.org/support/topic/allow-contributor-to-upload-media
 

ArchLinux: installing on GPT/LVM/GRUB 2 (no installer)

Boot into ArchLinux ISO

modprobe dm-mod

pacman -Syy

pacman -S gdisk

 

gdisk /dev/sda

o   then "y" to confirm

n

1

<enter>

+32M

ef02

n

2

<enter>

<enter>

8e00

w  then "y"  to confirm

—————

pvcreate /dev/sda2

vgcreate arch /dev/sda2

lvcreate -L 1G -n boot arch

lvcreate -C y -L 4G -n swap arch

lvcreate -L 10G -n root arch

lvcreate -l100%FREE -n home arch

 

————

mkswap /dev/arch/swap

mkfs.xfs /dev/arch/root

mkfs.xfs /dev/arch/home

mkfs.xfs /dev/arch/boot

———————

 

 

INSTALLATION

===============================

mount /dev/arch/root /mnt

cd /mnt

mkdir home boot

mount /dev/arch/boot boot

mount /dev/arch/home home

cd ..

 

pacstrap /mnt base base-devel

———-

genfstab /mnt >> /mnt/etc/fstab

——–

arch-chroot /mnt

 

pacman -Syy

pacman -S grub2-bios

grub-install –boot-directory=/boot –no-floppy –recheck –debug /dev/sda

 

grub-mkconfig -o /boot/grub/grub.cfg

 

nano /etc/mkinitcpio.conf

ADD "lvm2" between sata and filesystems

HOOKS=". . . sata lvm2 filesystems . . ."

 

run

mkinitcpio -p linux

 

 

exit

umount -a

reboot

 

Archlinux: Unable to boot installation “waiting for device labeled”

If you see this while trying to boot Archlinux installation

 

Waiting 30 seconds for device /dev/disk/by-label/ARCH_201210 …

Error: Boot device didn't show up after 30 seconds…

Falling back to interactive prompt.

You can try and fix the problem manually….

ramfs$

Label your device ARCH_201210 and you should be good to go.

Report your outcomes in the comments below

 

ArchLinux: set of fonts I’m using on my Asus N73SV laptop

This is the current set of fonts I've installed on my Asus N73SV laptop running Archlinux.

 

sudo pacman -Sy font-bitstream-speedo bdf-unifont artwiz-fonts cantarell-fonts dina-font gsfonts monaco-linux-font opendesktop-fonts tamsyn-font terminus-font ttf-bitstream-vera ttf-cheapskate ttf-dejavu ttf-droid ttf-freefont ttf-inconsolata ttf-sazanami ttf-ubuntu-font-family xorg-fonts-100dpi xorg-fonts-75dpi xorg-fonts-misc xorg-fonts-type1

 

Let me know in the comments if you have any contributions to the list.

 

(gs): Installing BugZilla into a subdomain

Download a BugZIlla tarball

Extract it to a public accessible web folder

 

 

Install all needed modules:

/usr/bin/perl install-module.pl –all

(lots of output)

 

Make the folder writable by the apache server

chmod a+w .

./checksetup.pl

 

Change it's settings

nano ./localconfig

—————-

 

$webservergroup = '';
$db_driver = 'mysql';
$db_host = 'localhost';
$db_name = 'bugs';
$db_user = 'bugs';
—————
 

 

./checksetup.pl

 

Bash: getting duplicate lines on both files

Today I needed to find duplicates files from:

– list of URLs accessed

– list of category URLs I needed to refresh data for

 

here's my code snippet:

(This assumes LOG.txt is the file with URLs logged and CATEGORIES.txt is the list of all URLs that would pottentially need to be refreshed)

 

for line in `cat CATEGORIES.txt`; do grep $line LOG.txt; done

 

You can see it in action and output to a file by adding:

| tee OUTPUT.txt