Skip to content

Instantly share code, notes, and snippets.

@rbochet
rbochet / Main.java
Created May 11, 2011 15:42
This program runs a server that give you the IP address of every client that try to connect. Its quite useful as a whatismyip service on a local network.
package fr.stackr.java.gimmeyourip;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
/**
* This program runs a server that give you the IP address of every client that
* try to connect. Its quite useful as a whatismyip service on a local network.
@rbochet
rbochet / Main.java
Created May 11, 2011 15:42
This program runs a server that give you the IP address of every client that tries to connect. It works on both side (display the IP and send it back). It is quite useful as a whatismyip service on a local network.
package fr.stackr.java.gimmeyourip;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.WriteAbortedException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
@rbochet
rbochet / UnixPipeActivity.java
Created May 18, 2011 03:45
How to write in pipes for Android
package fr.stackr.android.upt;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
@rbochet
rbochet / ssh-copy-id
Created August 23, 2011 15:29
ssh-copy-id for the operating systems without this command (like Ubuntu). Put it in the path and use it with 'ssh-copy-id [email protected]'
cat ~/.ssh/*.pub | ssh $1 'mkdir -p .ssh; chmod 700 .ssh; cat>>.ssh/authorized_keys'