Skip to content

Instantly share code, notes, and snippets.

@cemo
cemo / kafka-cheat-sheet.md
Created February 19, 2018 19:14 — forked from filipefigcorreia/kafka-cheat-sheet.md
Apache Kafka Cheat Sheet

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --delete-config retention.ms

@cemo
cemo / firehose-to-athena.js
Created February 16, 2018 16:25 — forked from tomodian/firehose-to-athena.js
Firehose to Athena
'use strict';
const aws = require('aws-sdk');
const s3 = new aws.S3({ apiVersion: '2006-03-01' });
exports.handler = (event, context, callback) => {
const key = decodeURIComponent(event.Records[0].s3.object.key);
const meta = key.split('/');
@cemo
cemo / web-servers.md
Created October 12, 2016 08:05 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@cemo
cemo / slackNotify.js
Created June 20, 2016 08:50 — forked from delemach/slackNotify.js
Parse SNS notification from Elastic Beanstalk and publish to Slack channel
var http = require('https');
var querystring = require('querystring');
// set the post request options
var reqOptions = {
hostname: 'hooks.slack.com',
port: 443,
path: '/services/YOUR/SLACK/HOOK_HERE',
method: 'POST'
};
#!/bin/sh
# set the configuration variables below, before running the script
# get the solr nightly build download link from https://builds.apache.org/job/Solr-Artifacts-4.x/lastSuccessfulBuild/artifact/solr/package/
JETTY_URL="http://eclipse.org/downloads/download.php?file=/jetty/stable-9/dist/jetty-distribution-9.0.5.v20130815.tar.gz&r=1"
JETTY_HOME="/opt/jetty"
JAVA='/usr/local/jdk1.7.0_09/bin/java'
JETTY_PORT=8085
JETTY_HOST=127.0.0.1
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
description "service"
start on filesystem
stop on runlevel S
respawn
respawn limit 10 5
oom never
kill timeout 86400 #If it's given a stop order, this is how long it will take to stop.
@WebServlet("/upload")
@MultipartConfig(location = "/tmp")
public class FileUploadServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
getServletContext().getRequestDispatcher("/WEB-INF/views/fileUpload.jsp").forward(req, res);
}
@Override
# Artie - Artie Server
#
# Real-time messaging service
description "artie"
start on filesystem
stop on runlevel S
respawn
package ecc.dashboard.persistent.repository;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;