Skip to content

Instantly share code, notes, and snippets.

View meddulla's full-sized avatar

Sofia meddulla

  • Cloudflare
  • Portugal
View GitHub Profile
@meddulla
meddulla / proxy.js
Created December 2, 2016 10:06 — forked from nakedible-p/proxy.js
AWS ES proxy
var AWS = require('aws-sdk');
var http = require('http');
var httpProxy = require('http-proxy');
var express = require('express');
var bodyParser = require('body-parser');
var stream = require('stream');
if (process.argv.length != 3) {
console.error('usage: aws-es-proxy <my-cluster-endpoint>');
process.exit(1);
@meddulla
meddulla / play.conf
Created February 16, 2016 15:08
Play framework upstart script
#
# Upstart script for Play Framework
# Put this into a file like /etc/init/play.conf
#
# Usage:
# initctl start play
# initctl stop play
# initctl status play
#
description "Start and Stop the play application"
@meddulla
meddulla / gist:cb77679595df505452b2
Created February 5, 2016 11:10 — forked from ochrons/gist:10681050
Super thin Scala wrapper for common DataStax Cassandra Java driver functionality.
object CassandraWrapper {
import scala.language.implicitConversions
import scala.language.postfixOps
/**
* Converts a `ResultSetFuture` into a Scala `Future[ResultSet]`
* @param f ResultSetFuture to convert
* @return Converted Future
*/
implicit def resultSetFutureToScala(f: ResultSetFuture): Future[ResultSet] = {
val p = Promise[ResultSet]()
@meddulla
meddulla / elasticsearch.md
Last active August 29, 2015 14:26 — forked from nicolashery/elasticsearch.md
Elasticsearch: updating the mappings and settings of an existing index

Elasticsearch: updating the mappings and settings of an existing index

Note: This was written using elasticsearch 0.9.

Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:

$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
  "_id": 1,
@meddulla
meddulla / gist:f03773df2fae22523e79
Last active August 29, 2015 14:26 — forked from ruflin/gist:1253270
Get has source
curl -XDELETE 'http://localhost:9200/test/'
curl -XPUT 'http://localhost:9200/test/'
curl -XPUT 'http://localhost:9200/test/test/_mapping' -d '{"test":{"properties":{"firstname":{"type":"string","store":"yes"},"lastname":{"type":"string", "store":"no"}},"_source":{"enabled":false}}}'
curl -XPOST 'http://localhost:9200/test/test' -d '{"firstname":"Nicolas","lastname":"ruflin"}'
curl -XPOST 'http://localhost:9200/test/test' -d '{"firstname":"Nicola","lastname":"ruflin"}'
@meddulla
meddulla / iptables.sh
Last active August 29, 2015 14:14 — forked from thomasfr/iptables.sh
#!/bin/bash
IPT="/sbin/iptables"
# Server IP
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')"
# Your DNS servers you use: cat /etc/resolv.conf
DNS_SERVER="8.8.4.4 8.8.8.8"
# Allow connections to this package servers
"""
Simple forking echo server built with Python's SocketServer library. A more
Pythonic version of http://gist.github.com/203520, which itself was inspired
by http://tomayko.com/writings/unicorn-is-unix.
"""
import os
import SocketServer
class EchoHandler(SocketServer.StreamRequestHandler):
@meddulla
meddulla / unicorn.py
Last active August 29, 2015 14:10 — forked from jacobian/unicorn.py
"""
Simple preforking echo server in Python.
Python port of http://tomayko.com/writings/unicorn-is-unix.
"""
import os
import sys
import socket
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"
# The url from where the 'config.vm.box' box will be fetched if it