How to verify whether cron job is setup correctly

You can use the tool run-parts to check if your cron job is configured correctly:


run-parts --test /etc/cron.daily/

This prints all the daily cron jobs (at least on ubuntu) without running them.
Ofc you can use this for the other cron dirs as well.

Remove target from atmel studio 6

I had several versions of my stk500 in atmel studio 6 because i was using different com ports.
There is no way to remove a target from atmel studio 6.1 via the gui.

If you want to remove the obsolete targets you have to edit the registry entry.

1. close atmel studio
2. open regedit.exe and search for "UserAddedTargets"
3. remove unnesessary entrys
4. restart atmel studio

VMware Fusion: Fehlender Netzwerkadapter

Wird ein VM Image kopiert, gibt VMware dem Netzwerkadapter automatisch eine neue MAC Adresse, um Kollisionen zu vermeiden. Allerdings identifiziert Ubuntu Netzwerkadapter über die MAC Adresse, sodass z.B. eth0 nach dem kopieren nicht mehr verfügbar ist, da der alte Adapter nun fehlt.

Um das Problem zu beheben lässt man sich im Gast System via ifconfig -a alle Netzwerkkarten anzeigen. Hier sollte auch eth1 aufgeführt sein.

eth1 Link encap:Ethernet HWaddr 00:0c:29:9c:f0:d1
inet addr:192.168.1.18 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe9c:f0d1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5621 errors:0 dropped:0 overruns:0 frame:0
TX packets:591 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1384390 (1.3 MB) TX bytes:49955 (49.9 KB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Nun muss man in der Datei /etc/udev/rules.d/70-persistent-net.rules die MAC Adresse von eth0 durch die von eth1 ersetzen. Der Adapter eth1 kann aus der Datei gelöscht werden.

Am Ende könnte das dann z.B. so aus sehen

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:9c:f0:d1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Nach einem Reboot sollte das Netzwerk wieder laufen.

Changing gitosis repository directory

It took me a while to figure it out, so i thought it might be useful to someone else as well.

Simply move the gitosis folder from /srv to the new directory and change the home directory of the gitosis user to the new location.

mv /path/to/new/gitosis/
usermod -d /path/to/new/gitosis/ gitosis

How to enable PHP and MySQL on OS X Snow Leopard

Since Snow Leopard ships with Apache and PHP preinstalled, there is no need to install third party tools like MAMP to run a local development enviroment. All you have to do is enable PHP in the httpd.conf and install MySQL.

To do so open a terminal window and edit the Apache config file located at /etc/apache2/httpd.conf

Uncomment the line

#LoadModule php5_module        libexec/apache2/libphp5.so

(should be on line 116) by removing the leading #

Restart the webserver with “apachectl restart”

Your apache should now run with php enabled. If you want to check if everything works so far, you can place a php file inside your web directory containing

<?php
  phpinfo();

The result should look something like this

Now that you have PHP running, you most likely want MySQL as well. You can download MySQL here http://dev.mysql.com/downloads/mysql/
Simply run the installation package and make sure to install the MySQL.prefPane as well.
Now you can start MySQL in System Preferences > MySQL

By default the MySQL socket is located in /tmp but PHP is looking for it in /var/mysql/

We can change this by editing the php.ini file.

But first we have to copy the default php.ini.

“sudo cp /etc/php.ini.default /etc/php.ini”

Now open /etc/php.ini and edit line 1216.

It should state:

mysql.default_socket = /tmp/mysql.sock

Save the file and restart Apache again

Finaly, test if PHP can connect to your MySQL server by creating a file in your web directory conatining

<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
printf("MySQL server version: %s\n", mysql_get_server_info());
<?php$link = mysql_connect('localhost', 'root', '');if (!$link) {    die('Could not connect: ' . mysql_error());}printf("MySQL server version: %s\n", mysql_get_server_info());

If everything went well the result should look like this:

Rapidshare premium download using python

I used to download from rapidshare using wget as descripted here.
Since Rapidshare changed there website this method stopped working, so I decided to write a simple python script using the rapidshare api to help me out.
There might be a few bugs but it generally serves its purpose.

#!/usr/bin/env python
 
import urllib
import os
import sys
 
args = sys.argv;
 
username = 'your_username'
passw = 'your_password'
 
linkfile = ''
link = ''
download_dir = ''
 
if '-h' in args or len(args) == 1:
  print 'Usage: ' + args[0] + ' options link || linkslist'
  print '\tOptions: '
  print '\t-h help'
  print '\t-d download directory e.g. /home/user/downloads'
  print '\t-l linklist'
  exit()
 
if '-d' in args:
  if args.index('-d') >= (len(args) - 1):
    exit('missing argument for -d')
  else:
    download_dir = args[args.index('-d') + 1]
 
if '-l' in args:
  if args.index('-l') >= (len(args) - 1):
    exit('missing argument for -l')
  else:
    linkfile = args[args.index('-l') + 1]
 
if '-l' not in args and len(args) > 1:
  link = args[len(args) - 1]
 
if linkfile == '' and link == '':
  exit('No links given. You have to give either a list of links or a single link. type ' + args[0] + ' -h for more information')
 
input = list()
if linkfile != '':
  input = open(linkfile, 'r')
else:
  input = [link]
 
for line in input:
  if(line == ''):
    continue
  linkmap = line.split('/')
  fileid = linkmap[4]
  filename = linkmap[5].rstrip()
  f = urllib.urlopen('http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles_v1&files=' + fileid + '&filenames=' + filename)
  serverid = f.read().split(',')[3]
  link = 'http://rs' + serverid + 'dt.rapidshare.com/cgi-bin/rsapi.cgi?sub=download_v1\&filename=' + filename + '\&login=' + username + '\&password=' + passw + '\&fileid=' + fileid
  os.system('wget -c -O ' + download_dir + filename + ' ' + link)

The scripts requires wget to be installed.

Kurz notiert: Photoshop CS5 grauen Hintergrund aktivieren

Unter OSX hat Photoshop standardmäßig keinen Rahmen sondern besteht nur aus einer Menüleiste und Werkzeugen etc.
Wer mit dem grauen Hintergrund besser zurechtkommt kann dies unter Fenster Anwendungsrahmen aktivieren

Kontakt: mail@gamgee.de