Below you will find pages that utilize the taxonomy term “Linux”
How to fix file permissions on debian
It just so happens I recently migrated a linux system from ext4 to btrfs and didn’t want to do a fresh install. So make a new partition, format it and copy the system over… Too bad I forgot to tell ‘cp’ to preserve the file permissions. I ended up with a system where every last file was owned by root and that obviously causes problem with everything that isn’t executed as root. And of course, the old partition was already gone - bad luck. Reinstalling is pretty much the only ‘solution’ I could find for this problem on the web. What follows are a few simple steps to resurrect a system to at least a runnable / good-enough state:
Migrating Sonar to a different host
Just a few notes on how to move your sonar installation to another machine without loosing any of your config and/or history. Some of that include the normal installation steps too. This list is specific to debian.
Add the sonar debian repo to your machine (/etc/apt/sources.list.d/sonar)
deb http://downloads.sourceforge.net/project/sonar-pkg/deb binary/
Update and install sonar (sonar pkg is not signed):
aptitude update && aptitude install sonar
Install postgresql and set up an account for your sonar:
Installing/Upgrading flash on Ubuntu behind a proxy
This just refused to work because the flashplugin-installer that actually downloads the packet doesn’t honor the http_proxy environment variable to I had to do a little hack to get this going. It’s actually pretty simple: download the file and serve it from localhost so we don’t need the proxy at all.
First shell:
- mkdir /tmp/flash
- cd /tmp/flash
- wget http://archive.canonical.com/pool/partner/a/adobe-flashplugin/adobe-flashplugin_11.2.202.310.orig.tar.gz
==> or whatever version YOU need - python -m SimpleHTTPServer 80
Second shell:
How to rename/merge projects in sonar
Sonar doesn’t support merging of projects out of the box so when you happen to rename a project as I just did, you’re suddenly stuck with 2 projects of the same name unless you do a little bit of sql trickery in the back. Here’s how you do it (quick & dirty approach). What we’re going to to is: rename the old projects (with all the juicy metrics) to the new groupid/artifactid and delete the new one (which only has a handful of builds anyway and we can afford to loose these, but not the yearlong history we’ve collected):
How to mount an iPod in linux
I’m currently trying to get rid of my iPod and move all my music to my android phone. Needless to say my iTunes installation on the PC is long gone and these iDevices are the proverbial bottomless bit - you’ll never get anything back out of them, or do you?
Thanks to the libimobiledevice and ifuse projects, you can now mount an ipod like any normal usb stick in linux, and it doesn’t even have to be a rooted device.
First steps on a new postgresql installation
I’ve found myself trying postgres over mysql for a few things and had some trouble accessing the db server at all at first. So here’s how you first access the server:
$ su - # su to root
# su - postgres # su to postgres
$ psql # access the server
That wasn’t so hard now was it? Once I’m in the psql shell, I tend to issue the following SQL statement so my primary user has unlimited access, to make things easier for development:
Resizing VirtualBox Drives
My Virtualbox images are usually fairly small. Here’s how to increase the size of a vbox disk, to 8G in this case:
vboxmanage modifyhd /home/user/vbox/vm/vm.vdi --resize 8192
After that, remove the disk from the vm it’s currently attached to, hook it to a new vm, which will boot from an iso file. Once booted, start gparted. It will complain that the gpt partition table is not (anymore) at the end of the disk, ignore that message and you’ll see the full disk with the initial partition plus additional space at the end. Resize the partition on the disk or create new partitions, whatever you like. Save the changes, stop the vm, move the drive back to the initial vm and start that one again.
Using awk to remove lines from a file
A little goodie I’m writing up here to document for my own future reference.
Objective: Remove all lines matching a certrain pattern from all files in a directory structure. The pattern is in the form of “part1.
First try: grep and sed, unfortunately that leaves me with blank lines where the matching content was and I want that line removed completely. Apparently sed can’t do that.
Second try: use awk with regexes. It took me a while and I wanted to use ’next’ on matching lines but that didn’t seem to work so I ended up printing the entire line if the regex didn’t match. Here goes:
Quality loss when saving as JPEG
So recently an article was linked on reddit about a bunch of photography myths. Number 7, called “Saving a JPEG multiple times degrades quality” which was apparently proven to be wrong disturbed me most and so I did a quick test on my own.
Further below are Three images. The Original, the one saved 30 times and an XOR of the first Two showing the differences. If you toggle between the first two you can see quite a difference in the color on the car and several other details. Running any more tests at lower than 100% quality is pretty much a waste of time once you see these results.
Tanuki Software's Java Service Wrapper and your Environment Variables
This post has been updated
Here’s an evil little gotcha I ran into when using the Tanuki Software Java Service Wrapper to run our company bamboo server. But first you need to know a little bit of context:
We had our bamboo agent running as root for a long time and about two months ago I changed that. I created a bamboo user and installed multiple agents. Each of these into its own folder along the lines of /home/bamboo/bamboo/java-agent-1
etc. Now in each of these is a wrapper script under bin/bamboo-agent.sh
. Reading up a bit on the wrapper I found out I can change the script and set the variable RUN_AS_USER=bamboo
and then simply create a symlink from /etc/init.d/java-agent-1
to /home/bamboo/bamboo/java-agent-1/bin/bamboo-agent.sh
and then start/stop the service just like any other normal unix service.
Tanuki Software's Java Service Wrapper and your Environment Variables
This post has been updated
Here’s an evil little gotcha I ran into when using the Tanuki Software Java Service Wrapper to run our company bamboo server. But first you need to know a little bit of context:
We had our bamboo agent running as root for a long time and about two months ago I changed that. I created a bamboo user and installed multiple agents. Each of these into its own folder along the lines of /home/bamboo/bamboo/java-agent-1
etc. Now in each of these is a wrapper script under bin/bamboo-agent.sh
. Reading up a bit on the wrapper I found out I can change the script and set the variable RUN_AS_USER=bamboo
and then simply create a symlink from /etc/init.d/java-agent-1
to /home/bamboo/bamboo/java-agent-1/bin/bamboo-agent.sh
and then start/stop the service just like any other normal unix service.
Automatically switch your mvn settings
I have one primary development notebook and take that with me wherever I go. Now in a company setting you usually have proxies and whatnot. And I think it’s an official best practice to roll your own company or departement maven proxy/cache.
So dependent on where you are, you might need a different maven ~/.m2/settings.xml file. Here’s a very simple shell function you can add to your ~/.bashrc
function mvn {
MVN="$(which mvn)"
if [ -n "$(ifconfig eth0 | grep YOUR-WORK-IP-HERE)" ]; then
echo ">>> Running mvn whith work config"
${MVN} -gs ${HOME}/.m2/settings-work.xml $*
else
echo ">>> Running mvn with vanilla config"
${MVN} $*
fi
}
This just checks for the ip of eth0 and calls mvn with a special settings.xml. In all other cases mvn is run with the vanilla config (or none, since the settings.xml is optional).
Automatically switch your mvn settings
I have one primary development notebook and take that with me wherever I go. Now in a company setting you usually have proxies and whatnot. And I think it’s an official best practice to roll your own company or departement maven proxy/cache.
So dependent on where you are, you might need a different maven ~/.m2/settings.xml file. Here’s a very simple shell function you can add to your ~/.bashrc
function mvn {
MVN="$(which mvn)"
if [ -n "$(ifconfig eth0 | grep YOUR-WORK-IP-HERE)" ]; then
echo ">>> Running mvn whith work config"
${MVN} -gs ${HOME}/.m2/settings-work.xml $*
else
echo ">>> Running mvn with vanilla config"
${MVN} $*
fi
}
This just checks for the ip of eth0 and calls mvn with a special settings.xml. In all other cases mvn is run with the vanilla config (or none, since the settings.xml is optional).
Mercurial and self-signed server certificates
So mercurial aborts when you want to interact with a repository that uses a self-signed certificate, as is the case for my own little mercurial repo exposed over https.
NOTE: this is obviously insecure and you must verify the ssl cert’s fingerprint is correct. If you roll your own server, log into the server and get the fingerprint from the cert file itself, not over https since there could be a man in the middle.
Mercurial and self-signed server certificates
So mercurial aborts when you want to interact with a repository that uses a self-signed certificate, as is the case for my own little mercurial repo exposed over https.
NOTE: this is obviously insecure and you must verify the ssl cert’s fingerprint is correct. If you roll your own server, log into the server and get the fingerprint from the cert file itself, not over https since there could be a man in the middle.
The simplest way to create pdf's from images
There’s probably no simpler way to create a pdf from images. Behold:
convert \*.jpg output.pdf
That’s all folks!
The simplest way to create pdf's from images
There’s probably no simpler way to create a pdf from images. Behold:
convert \*.jpg output.pdf
That’s all folks!
Using StarCluster for some heavy computing
Update: 2012-10-22
I recently put the scripts I used in a little github repo called starcluster-image-sharpener. It’s nothing big but it’ll get you started if needed. Go get them! ;)
Introduction
First a little context:
I’ve photographed a ton recently and on one occasion I screwed things up a bit and had a lot of slightly out of focus images. I’ve tinkered with the Canon Digital Photo Professional settings to find a good level of sharpening (after noise reduction because a lot was shot at high iso (for me and my 50D, iso 1250 is a lot already)) but wasn’t happy with it. I’ve found reasonable settings for noise reduction, which makes the image a bit softer, but sharpening wouldn’t do anything to compensate let alone actually sharpen.
Using StarCluster for some heavy computing
Update: 2012-10-22
I recently put the scripts I used in a little github repo called starcluster-image-sharpener. It’s nothing big but it’ll get you started if needed. Go get them! ;)
Introduction
First a little context:
I’ve photographed a ton recently and on one occasion I screwed things up a bit and had a lot of slightly out of focus images. I’ve tinkered with the Canon Digital Photo Professional settings to find a good level of sharpening (after noise reduction because a lot was shot at high iso (for me and my 50D, iso 1250 is a lot already)) but wasn’t happy with it. I’ve found reasonable settings for noise reduction, which makes the image a bit softer, but sharpening wouldn’t do anything to compensate let alone actually sharpen.
Local postfix as relay to Amazon SES
Introduction
Alright, this is a quick guide for the impatient but otherwise experienced linux admin/hacker/hobbyist. Some past postfix experiences might be advantageous for general understanding and troubleshoooting.
Why would I want a local postfix and relay to another smtp anyway? Simple: When my application code needs to send an e-mail, there is an SMTP server ready to accept the e-mail from me. It will then take care of everything else like re-delivery, dealing with being grey-listed and many other things. Also, if connectivity to the SES SMTP happens to be interrupted it’s no big deal because here too, the local postfix will handle re-sending for me. Nice, huh?
Local postfix as relay to Amazon SES
Introduction
Alright, this is a quick guide for the impatient but otherwise experienced linux admin/hacker/hobbyist. Some past postfix experiences might be advantageous for general understanding and troubleshoooting.
Why would I want a local postfix and relay to another smtp anyway? Simple: When my application code needs to send an e-mail, there is an SMTP server ready to accept the e-mail from me. It will then take care of everything else like re-delivery, dealing with being grey-listed and many other things. Also, if connectivity to the SES SMTP happens to be interrupted it’s no big deal because here too, the local postfix will handle re-sending for me. Nice, huh?
The simplest backup solution ever...
… not for everyone maybe, but for me as a linux/java/groovy person it is!
you’ll need
- java
- groovy
- rsync
- ssh
- cron
I want to regularly copy files from a bunch of paths from several remote hosts to the localhost. I know nothing about arrays etc in bash to configure this stuff in a simple way but the solution I’ve come up with is simple and elegant:
I wrote a little groovy script that generates the shell commands to be executed. the output of the groovy script is piped into bash, which executes the commands. That call of the groovy script with the piping to the bash is in a little shell script which is called from cron.