Skip to main content

Posts

Showing posts from 2010

Converting shapefiles (SHP) to a different projection

I've written a small perl script to handle converting the coordinates in shapefiles to a different coordinate set. You must specify the source EPSG projection and the destination EPSG projection, and the script will walk through the data and create a new shapefile with the coordinates transformed by using the new projection. The new files are saved next to the original files, with the projection number appended to the file names. Currently the script supports POINT data and LINESTRING data. All other geometries are ignored. In order to use this script you will need to have the following packages installed (example for ubuntu): shapelib, proj-bin, gdal-bin Sample usage: adrianp@frost:~/bin$ ./convertSHPProjection.pl epsg:4326 epsg:31700 ofm_fiber.shp Going to save data as ofm_fiber_31700.[shp/shx/dbf] Depending on your data size, this may take a while... Copying dbf file... Code: #!/usr/bin/perl use strict; use warnings; # Author: Adrian Popa # License:

Using AnyData ADU-510A under Linux (Ubuntu 10.04)

Using AnyData ADU-510A CDMA modem under Linux is a bit of a challenge because the device will appear like a virtual CD-ROM instead of a modem. You will need to "switch" the device (meaning turning it from being a CD-ROM to a modem), and then connect through PPP to your provider's network. Here are detailed steps on how to accomplish this on Ubuntu 10.04, using the modem associated with Romtelecom Clicknet Mobile service. It should work the same for other providers. 1. Download Saki's3g - a script that automatically switches your device from a CD-ROM state to a modem. You can get the latest version from http://www.sakis3g.org/ (great work, Saki!) Even if the site says it doesn't support CDMA networks, it can still be used to switch our modem using the embedded usb_modeswitch. Download the full version for your architecture and gunzip it somewhere in your home directory (~/bin for example). Also, give execute permissions to the script: adrianp@stingray:~/b

Cisco ANA: Change telnet credentials for all VNEs in an AVM

I wrote some scripts that will change the telnet username/password for all VNEs in a specific AVM. This is useful in order to change a password in bulk, or to comply to security policies. The scripts have been tested with ANA 3.6.7 and only work with VNEs that use telnet access. Details, examples and bugs can be found inside the README.txt from the scripts package:  Download from here Enjoy

Connecting with remote desktop (rdp) to a linux workstation

If you would like to connect to your Linux workstation the same way you connect to Windows workstations, or if you want to be able to connect from any Windows system to your Linux desktop without any other programs, than you probably want to use Remote Desktop Protocol . The good news is that Linux has an open-source implementation of the RDP protocol! Basically, the solution uses the following: xrdp to have your own RDP-speaking server - which will allow you to connect using Microsoft Remote Desktop, or any other client implementation ( rdesktop , remmina ) X11vnc will provide the interface to your desktop (it connects to an active X session, unlike other VNC servers which create a new session) First, you need to setup X11vnc and make sure it works properly; then you can setup xrdp and make the connection between xrdp and x11vnc. Then you are done. Setup x11vnc install x11vnc on your system (e.g. apt-get install x11vnc ) configure x11vnc to start when you login (via the GU

Starting LogMeIn in Safe Mode with Networking

The trouble with having remote access to a computer is that most of the time it fails miserably when you really need to fix that computer. For instance, you can't connect through LogMeIn to a computer started in Safe Mode (with Networking). I did a test today and if you start a PC in Safe Mode with Networking and you go to the Services application, if you try to right click and start the "LogMeIn" process, it will say it can't be started in safe mode. Bummer. Thankfully, there is a solution for that - you add the service to the trusted list of processes for Safe Mode, and presto, you can start it. You just need to add a key in the registry using this rather obscure command (start a new command prompt), and you are almost done: reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SafeBoot\Network\LogMeIn" /VE /T REG_SZ /D "Service" (one line). The output should be like in the next picture Now, the process can be started in safe m

samplicator system-v startup scripts

Samplicator looks like a great UDP fan-out tool for Linux/Unix. Unfortunately, it doesn't have proper startup/shutdown scripts. Here are, for your convenience such startup scripts adapted from apmd (currently tested only on Linux). Dependencies are: GNU grep and perl (to emulate a PID mechanism). #!/bin/sh # # chkconfig: 2345 26 74 # description: samplicator is a daemon to fanout UPD packets # processname: samplicator-syslog # Source function library. . /etc/init.d/functions RETVAL=0 SERVICE="syslog" UDPLISTENPORT=514 SOURCEIP="10.0.250.131" DESTINATIONS="10.0.250.132/514 10.0.250.61/514"; PIDFILE="samplicator-$SERVICE.pid" start() { echo -n $"Starting up samplicator-$SERVICE daemon: " daemon --check samplicator-$SERVICE /usr/bin/samplicate -f -p $UDPLISTENPORT -s $SOURCEIP -b 8388608 -S $DESTINATIONS; netstat -upan | grep -P "$SOURCEIP:$UDPLISTENPORT.*samplicate" | perl -e 'my $line= ; $line=~/([0-9]+)\/