Skip to main content

Posts

Showing posts from 2012

Missing menubar in (K)Ubuntu 12.10

After updating to and installing 12.10 of Kubuntu my GTK apps are missing their main menubars. Somewhere I read a cool solution that seems to work right offthe bat: sudo apt-get purge appmenu-gtk appmenu-gtk3 appmenu-qt

ORACLE JDK on Linux

This is a small summary for anyone who struggles often - on Ubuntu recently - to get the so called "Sun Java JDK", now belongs to Oracle onto their system. My strategy is to exclude any kind of Java packages from my installation and download only the self extracting JDK from the Oracle website . Once downloaded and extracted into my home directory I can easily  reference that directory in the various global variables that my softwares are searching for. On Ubuntu I use a dumb-simple shell script that is put into the /etc/profile.d directory with the extension of .sh . The content of my version is like this: export WEBIDE_JDK="/home/ikon/app/jdk" export RUBYMINE_JDK="/home/ikon/app/jdk" export SMARTGIT_JAVA_HOME="/home/ikon/app/jdk" export SMARTSYNCHRONIZE_JAVA_HOME="/home/ikon/app/jdk" Here the /home/ikon/jdk is where I extracted the JDK to. The variable names can be looked up from the starter shell scripts of the softwares. This

Using the same icon theme for GTK under KDE

I wanted to use Clearlooks on both Kde and within Kde all the GTK apps. But GTK apps started to use the default, ugly gnome icon theme. So I made this change to the following file, called .gtkrc-2.0-kde4 and back to business, using Oxygen icon theme everywhere ^_^.

Create desktop launcher in Ubuntu 12.04

There is a certain flaw in usability for power users in the new Ubuntu 12.04 out-of-the-box. I cannot create a desktop shortcut as easy as it was used to be. Instead, I have to install gnome-panels package and then use this command: gnome-desktop-item-edit Desktop --create-new to get a popup that was so natural it is a crime to miss it.

Find files and do something with them

Find removed (deleted) files still in use via /proc: # find -L /proc/*/fd -links 0 2 > /dev/null Remove .svn folders recursively. (I have seen solutions using the - exec switch, but it is too slow, so I use find's own delete option here) $ find . -name ".svn" -type d -delete; Find and delete files with multiple choice of names: $    find /path -name '.DS_Store' -or -name '._*' -delete  Finding file in .h with "raoul" in it ( the "-n" is for displaying line number ): $    find /path -name "*.h" | grep -n "raoul" Find empty folders: $    find /path -type d -empty Find empty folder and list: $    find /path -type d -empty -ls Find empty folder and save result in temporary file: $    find /path -type d -empty -fls /path/to/tempfile.txt

How to configure a local subdomain development with Linux

Note In the following scenario everything is done within one machine. This setup can be recreated with more then one machine as well. Use your imagination! Task I want to have subdomains like static.mydomain or whatever.mydomain . Ingredients any host OS that is capable of running Virtualbox , VMware or your favorite virtualisation software a linux distribution that uses/supplies a small kernel, like Ubuntu server, Fedora without X, Arch or any of your choice, preferably one that you are familiar with. Of course if you are not a linux guru you can  still use a gui, just give enough memory for your guest linux. Setup process have your virtualisation software set up on your host install your linux distro of choice as a guest, it is best to use at least one "Bridged" (my choice) or "Host only" network adapters that every other guest machine can see too if you later need it.  set up your /etc/resolv.conf  file to have your nameservers in the

Access a remote service localy via ssh

This will be just a short reminder for myself not to forget how to forward a remote service's port to a local one through ssh. Here is the schema: ssh -i .ssh/ssh_keys/root -L 55432:localhost:5432 root@thinks.iamallama.com With -i we use a private key to the remote host's user named root at the end. Next we say we want to access a local port -55432- and send the data through that one to the remote port -5432-. We want to use our localhost to address the service which is hosted on the thinks.iamallama.com machine. This wraps it up. ^_^

How to cut FLAC with CUE files

I have read the best and simplest procedure for Windows on this forum thread:  http://www.head-fi.org/t/547712/cut-a-flac-ape-file-with-the-cue Here is the recipe: Get Flac , you just need flac.exe, put it in some directory; Open the .cue file in Foobar; Select all the tracks, right-click, choose 'convert', choose '...'; Click 'output format', choose FLAC, click 'edit' and set it to 8; Click 'destination' and choose your options; Click 'processing' and make sure 'enable decode...' is off, and 'active dsps' is empty; Click convert, foobar will ask you were you put flac.exe, navigate to it and voila. You can use the "bit compare" plugin to make sure the new converted tracks are bit identical to the original ones.

Directory tree in Bash

I was recently searching for a bash script that could be used to create the skeleton of a yaml file containing directory structure. The best material I found is here: http://systembash.com/content/one-line-linux-command-to-print-out-directory-tree-listing/ With the modification of this line: find ./ -type d | sed -e 's/[^-][^\/]*\//--/g;s/--/ |-/' I managed to produce the best skeleton: find ./ | sed -e 's/[^\/]*\// /g' Since I still have to shape this file up with more data I am not bothering with finding a method to put the ':' at the end of each directory as I can do it myself with little effort. I use Vim's visual mode to get rid of the extra leading spaces at each line.

Limiting Access with SFTP Jails on Ubuntu

This post is based on this article with it's comments. In the /etc/ssh/sshd_config file edit the Subsystem like this: Subsystem sftp internal-sftp Add these to the end of the file: Match group filetransfer   ChrootDirectory %h   X11Forwarding no   AllowTcpForwarding no   ForceCommand internal-sftp Finally restart the OpenSSH server: service ssh restart Create the group for sftp access: addgroup filetransfer If you add this group to existing users, then they will be prevented to login via remote shell, though still be available through su . usermod -G filetransfer username chown root:root /home/username chmod 755 /home/username Now users cannot create anything in their jail, but it can be tuned with the last command. Though I personally use this technique to jail those users that are able to manage their own websites' content through sftp. I add those web directories through mount 's bind option as the normal symlinks won't work. You can eit

Convert virtual machine disks VDI to VMDK

I recently wished to migrate my dev vm from VirtualBox To VMware. So the only thing I needed is to convert the VDI virtual disk into VMware's VMDK format as VirtualBox can read several disk types but VMware needs it's own child. So as long as VirtualBox is still installed, I could use this simple command: vboxmanage clonehd old_virtualbox_disk.vdi new_vmware_disk.vmdk –format VMDK –variant standard Obviously, you have to find the vboxmanage executable yourself on your system. This command is crossplatform. :)

Sync MAC address of virtual machine

When I use VirtualBox or VMware I sometimes have to change the network adapters of the virtual quests and there comes the problem in case of my Ubuntu VMs that their ethX adapter's expected MAC address differs from the one they get from the host. Here is that single config file that you have to sync to contain the new address: /etc/udev/rules.d/70-persistent-net.rules The setting containing MAC address in the interface's line is: ATTR{address}==""  After reboot everything is ok :)

Faster transactions in PostgreSQL

First of all: BE WARNED!   These settings are not recommended for all of you (if any) in production as they might cause you data corruption or loss in case of sudden hardware failure. I would on suggest to have these settings used in a development environment, where you have to run many tests for your application which include database side create/drop transactions. My case here was that I ran so much database inclusive tests, that I got fed up with PostgreSQL's ~6s database creation time. So I just Googled it a few days how this could be done in a dev env. So here it is, you just set these two variables in your postgresql.conf file and reastart the database. fsync = off full_page_writes = off

How do I install my Nginx with Passenger

While there are pretty much use to run a project in standalone Passenger I'd rather run it with the web server of the production environment. My choice is Nginx . Not because of it's high load speed as I do not (yet) run any high visited websites or loaded applications, but I have found it's configuration simpler then Apache's. Yes, not modular, you cannot enable, disable some things in runtime, but hey I do not really need that either. So basically I download the nginx source, extract it somewhere. Install the passenger gem. Then run this command: rvmsudo passenger-install-nginx-module If it finds every package installed - note that you might need  libpcre3 and libpcre3-dev  packages too on Ubuntu - then I choose the option 2 which will let me configure nginx further. When it asks for the extra arguments for configure I use these: --prefix=/etc/nginx --user=www-data --group=www-data --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=

Mount Windows share on Ubuntu with CIFS

The package that is needed to be installed is called smbfs . For permament mount at every boot add something like this to /etc/fstab : //192.168.0.65/privatefolder /media/servfolder cifs username=xxxxx,password=yyyyyy,uid=1000,gid=1000,file_mode=0777,dir_mode=0777noserverino,rw,nolinux,iocharset=utf8 0 0 As a shell script, the command would be like this: mount -t cifs //192.168.x.x/hostdir /opt/clientdir -o username=hostuser,password=hostuserpass,uid=1000,gid=1000,file_mode=0664,dir_mode=0775,noserverino,rw,iocharset=utf8