Skip to content

Instantly share code, notes, and snippets.

@russellhoff
russellhoff / database-backup.sh
Last active October 19, 2017 07:53 — forked from stevegrunwell/database-backup.sh
Dump each MySQL database and send its backup to Amazon S3. https://engineering.growella.com/automatic-database-backups-amazon-s3/
#!/bin/bash
#
# Backup local databases to Amazon S3.
#
# This script takes a single argument: an S3 bucket name with optional path.
#
# Usage:
# database-backup.sh backup.example.com
# database-backup.sh backup.example.com/some/path
#
@russellhoff
russellhoff / CheckInternet.java
Created September 27, 2017 13:51
Check Internet Connection in Java
package internetcon;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
public class CheckInternet {
public static void main(String[] args) {
System.out.println(
"Online: " +
@russellhoff
russellhoff / GeometriesFactory.java
Created May 25, 2017 08:48
A simple factory to create Points and Linestrings with 4326 srid.
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.PrecisionModel;
public class GeometriesFactory {
private static GeometryFactory factory4326 = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4326);