Instantly share code, notes, and snippets.

View client.java
static final String alphabet = "0123456789ABCDE";
public static void main(String[] args) throws UnknownHostException, IOException {
System.setProperty("javax.net.ssl.trustStore", "C:\\path\\to\\java\\truststore.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "Password1");
SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket sslsocket = (SSLSocket) factory.createSocket("127.0.0.1", 7000);
OutputStreamWriter writer = new OutputStreamWriter(sslsocket.getOutputStream(), "UTF-8");
char[] buffer = new char[9];
Random r = new Random();
View server.java
public static void main(String[] args) throws IOException {
System.setProperty("javax.net.ssl.keyStore", "C:\\path\\to\\keystore\\store.jks");
System.setProperty("javax.net.ssl.keyStorePassword", "Password1");
SSLServerSocketFactory ssf = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
ServerSocket ss = ssf.createServerSocket(7000);
System.out.println("started");
while (true) {
Socket s = ss.accept();
System.out.println("connected");
InputStreamReader reader = new InputStreamReader(s.getInputStream());
View s3copy.sh
s3key=your key
s3secret=your secret
function putS3
{
object=$1
sourceBucket='bucket'
destinationBucket='bucket'
date=$(date +"%a, %d %b %Y %T %z")