Skip to main content

Posts

Showing posts with the label system administration

Switching between keyboard layouts in Openbox (Arch Linux)

Switching between two (or more) keyboard layouts in Openbox DE is a task that's quite easy to accomplish, although it might not be so obvious as in other desktop environments. This solution was tested on Arch Linux. You just need to edit this file (assuming you want to switch between English and Ukrainian Phonetic layouts with Alt-Shift): /etc/X11/xorg.conf.d/01-keyboard-layout.conf Section "InputClass" Identifier "keyboard-layout" Driver "evdev" MatchIsKeyboard "yes" Option "XkbLayout" "us,ua(phonetic)" Option "XkbModel" "pc105" Option "XkbOptions" "grp:alt_shift_toggle" EndSection If you have Nvidia card, don't forget to edit /etc/X11/xorg.conf.d/20-nvidia.conf and change Driver from "kbd" to "evdev" in InputDevice section: Section "InputDevice" Identifier "Keyboard0" Driver "evdev" EndSection Y

Increasing sound volume for recorded files on Linux

One-liner for increasing sound volume for recorded files on Linux (make sure ffmpeg is installed): for file in *.3gp; do ffmpeg -i "$file" -af "volume=15.0" ./conv/"${file%.3gp}".mp3; done The line above will increase sound 15X for all files with .3gp extension in the current directory and saves the resulting .mp3 files into ./conv subdirectory (make sure it exists).

How to run Jekyll server on Cloud9

So you already have your Cloud9 account and your Jekyll site is in your workspace. Now you want to run the server. It is actually very simple. In a fresh Could9 workspace you only need to execute the following two commands in the terminal window: gem install jekyll jekyll serve --host 0.0.0.0 --port 8080 After executing these two commands you can open your site in the browser using the following link: https://[workspacename]-c9-[username].c9.io Important note: Only port 8080 works for me in Cloud9, other ports are closed. Also assigning host to 0.0.0.0 is necessary.

Stray process cleanup in your test automation suite

Occasionally any large test automation suite leaves some stray browser and/or webdriver processes behind during test execution. They make our test suite slower and cause other issues, for example a stray process process may hold entire directory and prevent it from cleaning. Clean test environment is very important for test isolation and prevention of false positives. This is an example of process cleanup in Linux where we find the processes in question by their names and kill them. And here is another example where we do the same process cleanup in Windows Powershell.

Using SED and TR tools for text manipulations

SED and TR command line tools are very useful tools to perform various text manipulations in Linux. You can also find them on Mac OS X, however be aware that they could work a little differently from the same tools on Linux OS. Two very simple, but extremely useful one-liners (tested on Linux Ubuntu OS). The first one is wrapping your text with a div tag and "lazyload" class, also it wraps the text into HTML comment tags. The second one-liner is removing all newline characters from the text.

How to control CPU frequency on Linux Fedora 20

Sometimes you need to make CPU run faster or slower, depending on your needs. In Linux you can control this by using different CPU governors. The following steps were tested on Fedora 20, but most likely they would also work on later versions of Linux Fedora OS. sudo yum install kernel-tools Check the available CPU governors: sudo cpupower frequency-info --governors sudo cpupower frequency-set --governor [governor] More information about the governors here: http://docs.fedoraproject.org/en-US/Fedora/20/html/Power_Management_Guide/cpufreq_governors.html

Solution for com.jcraft.jsch.JSchException: reject HostKey problem on Ubuntu

Just a random investigation with a workaround. So trying to connect to SFTP server using jsch library, but getting a nasty com.jcraft.jsch.JSchException: reject HostKey exception. This host is already present in ~/.ssh/known_hosts file, so it should not be problem, but it is. It turns out this problem happens if SFTP server is running on Ubuntu and strictHostKey is set to true, but it doesn't happen on Linux Fedora. I suppose this is because host entries in the known_hosts file on Ubuntu are encrypted in a different way than in known_hosts on Fedora, so it cannot be recognized or decrypted by JSch library. Now all you need to do is manually add host entries to the file. Basically you just get the public key for the host where SFTP server is running using this command: ssh-keyscan -t rsa sftp_server_ip_address_or_hostname Then copy-paste the output to your local ~/.ssh/known_hosts file. That's all, it should work now. If it doesn't, try to empty known_hosts file complet

Setting up SFTP server in Linux Ubuntu. Command line instructions

Simple step-by-step command line instructions on setting up SFTP server in Ubuntu 12.04, based on http://www.thegeekstuff.com/2012/03/chroot-sftp-setup/ article. 1. Add 'sftpusers' group: sudo groupadd sftpusers 2. Create a home directory for 'guestuser' user that will be added at the next step: sudo mkdir /var/guestuserhomedir As the result of the above command permissions for /var/guestuserhomedir should be 755 (owner: root, group: root). 3. Create 'guestuser' user, add it to the 'sftpusers' group and set a new password for this user: sudo useradd -g sftpusers -d /var/guestuserhomedir -s /usr/sbin/nologin guestuser sudo passwd guestuser 4. Create SFTP directories and set permissions (correct permissions are important): sudo mkdir /var/sftp_upload_dir sudo mkdir /var/sftp_upload_dir/guestuser sudo mkdir /var/sftp_upload_dir/guestuser/incoming sudo chown guestuser:sftpusers /var/sftp_upload_dir/guestuser/incoming sudo chmod 777 /var/sftp_u

Accessing your Linux workstation in a corporate network from home PC

Running the following commands assumes that you have already started OpenSSH server at workstation and opened port 22 at your home router. Opening 22 or any other port at workstation is not needed, the only precondition is that you should be able to ping your home PC from the workstation. How to setup SSH tunnel to your workstation from outside corporate network (for example, from home to work)? You should run this command on your workstation: ssh -f -N -q -R 2222:localhost:22 yourhomeusername@yourhomeip Now you can connect from home to your workstation via SSH using this command: ssh -p 2222 yourworkusername@localhost You can even create a fully-functional session on your Linux desktop using No Machine tools ( http://www.nomachine.com/ ). Just install node and server components on your workstation and connect via client from your home PC. A new session will be created. Also you can directly run some programs which require X server (but the interaction speed will be pretty slow) b