Sunday, January 03, 2016

.AppleDouble files on Linux

To get rid of those .AppleDouble files which OSX creates when accessing folders on Linux, first disable the creation of these files

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Then use the following script to remove every .AppleX file created:

#!/bin/bash

if [ -z "$2" ]
       then
               echo "Use --really to remove appledoubles"

fi

if [ -z "$1" ]
       then
               echo "No arguments supplied"
               echo "Use --really to remove .AppleDouble files"
               exit 1
       else
               find $1 -name .AppleDouble -exec ls -d {} \;
               find $1 -name .AppleDesktop -exec ls -d {} \;
               find $1 -name .AppleDB -exec ls -d {} \;
fi

if [ "$2" == "--really" ]
       then
               echo "RUNNING DELETE"
               find $1 -name .AppleDouble -exec rm -r {} \;
               find $1 -name .AppleDesktop -exec rm -r {} \;
               find $1 -name .AppleDB -exec rm -r {} \;
               echo "Done. .AppleDouble files obliterated\n"
       else
               echo "nothing"
fi

Sunday, February 02, 2014

Debian & Raspbian for dummies

Start the configuration interface:
   raspi-config

To execute some commands You need administrative rights. You do that with "sudo". Example: see the IP and network for the main ETHernet interface:
    sudo ifconfig eth0

Switch to administrative user to avoid the need to type in sudo all the time:
   sudo -i

Update the system (you need administrative rights, see above):
   apt-get update; apt-get upgrade

Edit a configuration file (save with CTRL+X ) :
   nano /etc/hosts.allow

Search online for software, for example a media player:
   apt-cache search media

You'll get 1000 results, now narrow them down with filtering (| is the pipe sign):
   apt-cache search media | grep player (for narrowing down results)
   apt-cache search media | more (for listing the results in a program which allows scrolling)

You have now found what you seek. Install VLC
   apt-get install vlc

Kill the X-server if you want to go console-only: CTRL+BACKSPACE
When in console mode you might want to have a manual on one "page" and execute stuff on another "page" : Open a new console window with ALT+2 , ALT+3. Switch back to the first with ALT+1

Find a file when you know its name: "find" command , / is the root filesystem
   find / -name hosts.allow
Find a file when you only know parts of the filename:
   find / | grep hosts

Shutdown system:
   poweroff

Reboot system:
   reboot

Look at the system logs - change to the log directory, then show one:
  cd /var/log ; cat dmesg
  cat /var/log/auth.log

Raspberry Pi
----------------

Install software for camera monitoring
   apt-get install motion
see http://en.wikipedia.org/wiki/Motion_(surveillance_software) for more info and documentation

Monday, October 21, 2013

Remote debugging a java application

You can remote debug a running applet. Set it in the Java control panel, in "runtime parameters" for the JRE
-Djava.compiler=NONE -Xnoagent -Xdebug 
-Xrunjdwp:transport=dt_socket,address=127.0.0.1:8888,server=y,suspend=n for JVM 1.4
or -agentlib:jdwp=transport=dt_socket,address=localhost:8000,server=y,suspend=n for JVM 1.5 and newer

These are considered insecure JVM parameters and will cause the LiveConnect error: "This application is going to perform an insecure operation" See StackOverflow LINK for more info


How to set the parameters:


This is equivalent to setting the JAVA_OPTS environment variable.


The settings in Eclipse:


For the uninitiated: the idea is that the JVM starting the applet looks at the server parameter. If it's set to 'y' then the applet running JVM acts as a debugging server. You then from Eclipse (or another IDE) connect with Socket Attach. You start the application, and start the debugging session in your IDE, which connects to the running applet.

 If you set server=n then in Eclipse you set the connection type to Socket Listen,  which means that Eclipse acts as a debugging server. You start the debugging session in Eclipse, the debugging server starts and waits. You then start the web application (or applet) which will connect to Eclipse).

If you need to debug the whole applet loading procedure You can set the suspend=y parameter. You start the web application, and the applet start will be paused, waiting for you to start the debugging session against it.

Note: Enabling JWDP debugging seems to break running through a proxy ( such as fiddler ). The control pannel settings for network and proxy are ignored, and proxy=DIRECT is chosen always

Friday, March 22, 2013

HOWTO: OpenVPN connection with traffic routing in Windows


So from SITE1 I wanted to connect to a remote SITE2 and run my browser against SITE3 through the proxy at SITE 2 in order to debug a web application.

In order to do this I need to install an OpenVPN server at SITE2 and an OpenVPN client at SITE1
SITE2 will be first accessed through TeamViewer to create a connection, then we create the VPN tunnel throgh the TeamViewer connection.

Steps:
Install the OpenVPN software ( http://openvpn.net/index.php/download/community-downloads.html ) at SITE2 and SITE1

At SITE2 set up the server, generate certificates for server and client in the easy-rsa folder of OpenVPN
At SITE1 set up the client, copy the certificates from the server

server.ovpn
# the ip of the vpn server machine
local 10.158.226.50
port 1194
proto udp
dev tap
dev tun
ca "C:\\Program Files (x86)\\OpenVPN\\easy-rsa\\keys\\ca.crt"
cert "C:\\Program Files (x86)\\OpenVPN\\easy-rsa\\keys\\server.crt"
key "C:\\Program Files (x86)\\OpenVPN\\easy-rsa\\keys\\server.key"  # This file should be kept secret
dh "C:\\Program Files (x86)\\OpenVPN\\easy-rsa\\keys\\dh1024.pem"
# this will redirect all traffic, even HTTP, over the vpn tunnel
push "redirect-gateway def1"
# this will enable DNS lookup over the VPN tunnel
push "dhcp-option DNS 10.8.0.1"


client.ovpn

remote 10.158.226.50 1194
ca "C:\\Program Files\\OpenVPN\\easy-rsa\\keys\\ca.crt"
cert "C:\\Program Files\\OpenVPN\\easy-rsa\\keys\\client1.crt"
key "C:\\Program Files\\OpenVPN\\easy-rsa\\keys\\client1.key"


In windows networking select the default ethernet connection "Local Network Connection" Control Panel\All Control Panel Items\Network and Sharing Center and when the dialog appears, check "Allow network users to connect through this computer's internet connection". Select Local Area Connection 2, which should be Your VPN connection interface 10.8.0.1

Start server, connect client, and bada-bing, you're now surfing through a VPN tunnel.
Of course this would be a good way to access Your home computer from work to do all the private surfing hidden from the eyes of your friendly IT-administrator.

Wednesday, September 26, 2012