This is one possibility to do this. There are other and maybe even better ways to do this.
Generate a key for your encrypted harddisk:
dd if=/dev/random of=/home/bob/keyfile_sdb1 bs=4096 count=1
Then add your keyfile to encrypted harddisk: How to change your dm-crypt passphrase (step 3)
Create a mountpoint:
mkdir /mnt/space
Create a script e.g. in your homedirectory (/home/bob/mount_sdb1.sh):
#!bin/bash
...
TeamViewer 6 and lower had an issue where they would see a multi-monitor Linux setup as a single wall of pixels. This is fixed in version 7. The guest can now select the currently active screen from the TeamViewer menu.
Sometimes you need to restart the Gnome panel, e.g. when you installed a new Gnome panel widget but the widget list was cached before.
You often don't want to do sign out and back in for this.
Instead, just run:
killall gnome-panel
This will terminate all gnome-panel
processes. On my machine (Ubuntu 11.04) the panel then restarted itself after a moment.
If the panel does not automatically come back, press Alt+F2
to bring up the Gnome "run" box and start gnome-panel
from there.
SkypeTab-NG (NG stands for Next Generation) is a tool that adds tabs to Skype for Linux. Besides providing a tabbed chat window, the SkypeTab-NG also embeds both the conversation and the main Skype windows in a single window.
When Rack::Bug
has been added to your project and your Apache2/Passenger only replies with an Error 500 (Internal Server Error
) you won't get any love from both application and Apache logs.
You can start a script/server
and try connecting there. It should also fail but you will most likely see this error:
Internal Server Error
undefined method `new' for "Rack::Bug":String
While the following is (for some reason) working on OSX...
config.middleware.use "Rack::Bug", :secret_key => '...'
...you need to do this so it wor...
Web fonts are awesome. After being restricted to Arial for two decades there is finally a cross-browser way to embed fonts into web pages.
Unfortunately while web fonts look awesome on Linux and MacOS, they look horrible on Windows, a problem that gets worse with smaller font sizes.
The culprit is something called font hinting:
...
When you install Type 1 fonts (like makandra's corporate typeface), they won't show up in OpenOffice. OpenOffice requires some additional files to process them. Stefan Gründel found out what to do.
There is a tool that can produce the missing files:
sudo apt-get install t1lib-bin
Now you can create .afm
files:
cd ~/.fonts
type1afm *.pfb
Restart OpenOffice and the fonts should show up.
When using the screen
tool you may be unable to start a screen session but instead encounter an error:
Cannot open your terminal '/dev/pts/0' - please check.
This is because another user (you) initiated the current terminal -- you probably did a sudo su
into the user you are now trying to run screen as, right?
There are two ways to resolve this:
script /dev/null
to own the shell (more info over at [Server Fault](http://serverfault.com/questions/116775/...The colors in Rails log files are helpful when watching them but, since they are ANSI color codes like ^[[4;36;1m
, can be annoying when you are reading the logs with a tool that does just prints those control characters (like less
or vim
).
Remove them with sed
:
cat staging.log | sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g"
This will print the log without colors to your terminal. You can pipe the result into less
for example.
To have a file you can vim
around with, just write that output into a new file:
ca...
This will reduce the filesize of foo
and bar
to 0 bytes:
truncate -s0 foo bar
If the files do not exist they will be created.
You can use this to easily truncate your application's log files:
truncate -s0 log/*.log
You can use fold
:
fold -sw 60
You can now paste your texts. fold
will echo them back, word-wrapped after 60 columns. Exit with Ctrl+C
or Ctrl+D
.
You can also use files for input and output:
fold -sw 60 input.txt > output.txt
When you drag a file from a Nautilus window into a terminal window, the file's path will be pasted into the terminal. This also works with multiple files.
Whenever Firefox updates, all your Cucumber features that use Selenium break. This is annoying.
In order to remedy this, version 0.5.0 of our geordi gem comes with a script that helps you create an unchanging version of Firefox for your Selenium tests. In particular, this new copy of Firefox will have the following properties:
Microsoft provides virtual machine disk images to facilitate website testing in multiple versions of IE, regardless of the host operating system. Unfortunately, setting these virtual machines up without Microsoft's VirtualPC can be extremely difficult. These scripts aim to facilitate that process using VirtualBox on Linux or OS X. With a single command, you can have IE6, IE7, IE8 and IE9 running in separate virtual machines.
Great blog with daily news and HOWTOs for Ubuntu, Linux and Gnome.
Note that converting from RGB to CMYK will usually degrade your colors because no exact mapping is possible. Anyway, this Stackoverflow post worked for me:
gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \
-sColorConversionStrategy=CMYK -dProcessColorModel=/DeviceCMYK \
-sOutputFile=output.pdf input.pdf
Use the PDF toolkit:
sudo apt-get install pdftk
To rotate page 1 by 90 degrees clockwise:
pdftk in.pdf cat 1E output out.pdf # old pdftk
pdftk in.pdf cat 1east output out.pdf # new pdftk
To rotate all pages clockwise:
pdftk in.pdf cat 1-endE output out.pdf # old pdftk
pdftk in.pdf cat 1-endeast output out.pdf # new pdftk
The E
(old pdftk) or east
(new pdftk) is meaningful if you want other rotations. From the man
page:
The page rotation setting...
Linux provides a fix number of filesystem watches. If you have some greedy daemon (like dropbox) running, chances are it uses all of them, and you cannot use tail -f
any more.
To increase the number of watches, put something like
fs.inotify.max_user_watches = 32768
into /etc/sysctl.conf
. (default is 8192)
To update the setting right away, run
sudo sysctl -p /etc/sysctl.conf
afterwards.
Grep prints one line per match. To return the number if matches, use the -c
switch:
grep -c "something" filename
However, if a word appears more than once in a line, it is only counted once.
To count every match, you can use sed
to force line breaks on multiple matches:
sed 's/something/something\n/g' filename | grep -c "something"
This is now part of geordi. Please don't follow the instructions below, if you use geordi.
Inspired by the recent headless Selenium note, I found yet another solution for the problem to hide your selenium tests away.
This has the advantages
^
Simply make a script th...
When you have a program running in a hidden X screen (like with Xvfb for Selenium tests) you may want to look at that hidden screen occasionally.
First, find out what X displays are currently active:
netstat -nlp | grep X11
This should give you some results like these:
unix 2 [ ACC ] STREAM LISTENING 8029600 4086/Xvfb /tmp/.X11-unix/X99
unix 2 [ ACC ] STREAM LISTENING 8616 - ...
Ubuntu comes with keyboard layouts like "Germany Eliminate Dead Keys", which are practical for programming.
If you need to type accented characters with such a layout, make sure to configure a Compose key. You can then look up which compose combo will produce the character you need.
E.g. you can type "á" by pressing Compose, ´, a
.
Sometimes you need a file of some size (possibly for testing purposes). On Linux, you can use dd
to create one.
Let's say you want a 23 MB file called test.file
. You would then run this:
dd if=/dev/zero of=test.file bs=1048576 count=23
The block size (bs
) is set to 1 MB (1024^2 bytes) here, writing 23 such chunks makes the file 23 MB big.\
Adjust to your needs.
This linux command might also come in handy in a Ruby program. It could be used like:
mb = 23
mb_string, _error_str, _status = Open3.capture3('dd if=/dev/zero...