Skip to content

Instantly share code, notes, and snippets.

@amiorin
amiorin / hit.sh
Created October 5, 2017 15:27 — forked from pesterhazy/hit.sh
hit - git-style interface for project helper scripts
#!/usr/bin/env bash
set -euo pipefail && cd "$(dirname "${BASH_SOURCE[0]}")/.."
# hit - git-like command dispatcher. Who needs Makefiles?
#
# Create a directory `bin/` at the top level of your project
# directory (the one committed to git). Copy this file into
# that folder, call it `hit` and make it executable.
#
# Type `bin/hit NAME` to run a subcommand called NAME. Subcommands
@amiorin
amiorin / s3-curl-backups.md
Created April 10, 2017 13:52 — forked from jareware/s3-curl-backups.md
Simple, semi-anonymous backups with S3 and curl

⇐ back to the gist-blog at jrw.fi

Simple, semi-anonymous backups with S3 and curl

Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl. Hold onto your hats, there's some Bucket Policy acrobatics ahead.

There's also a tl;dr at the very end if you just want the delicious copy-pasta.

Bucket setup

@amiorin
amiorin / S3Puller.scala
Created August 8, 2016 15:22 — forked from pjrt/S3Puller.scala
S3 List Status ad-infinitude
import com.amazonaws.services.s3._, model._
import com.amazonaws.auth.BasicAWSCredentials
val request = new ListObjectsRequest()
request.setBucketName(bucket)
request.setPrefix(prefix)
request.setMaxKeys(pageLength)
def s3 = new AmazonS3Client(new BasicAWSCredentials(key, secret))
val objs = s3.listObjects(request) // Note that this method returns truncated data if longer than the "pageLength" above. You might need to deal with that.
/**
* Required Variables.
*/
variable "name" {}
variable "port" {}
variable "elb_security_group" {}
variable "elb_subnets" {}
package spark.examples
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.json4s.jackson.JsonMethods
import org.json4s.jackson.JsonMethods._
import org.json4s.JsonAST._
object HDFSDeleteExample {
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "idea"
group = "com.mycompany.hadoopproject"
version = "1.0"
repositories {
// Standard Maven
mavenCentral()

node-websocketd

A lightweight node port of websocketd, originally written in go.

Usage

node-websocketd --port=8080 ./count.sh