Skip to content

Instantly share code, notes, and snippets.

View Seraf's full-sized avatar

Julien Syx Seraf

View GitHub Profile
#!/usr/bin/python
import json
import os
from flask import Flask
from ConfigParser import ConfigParser
app = Flask(__name__)
LOGICAL_DIR = "{{ vault_backend_path}}/logical/"
VAULT_URL = "https://{{ vault_default_cert_url }}:{{ vault_default_port }}"
from lisa_api.lisa.logger import logger
import requests
import json
class WitNLP(object):
def __init__(self):
self.token_wit = 'XXXXXXXXXXXXXXX'
self.nlp_json = None
self.lisa_api_url = 'http://127.0.0.1:8000'
@Seraf
Seraf / etc_sensu_conf.d_extensions_mailer-ses.json
Last active January 9, 2017 16:50
mailer-ses.rb extension for sensu to avoid fork bomb
{
"handlers": {
"mailer": {
"command": null,
"type": "extension",
"severities": [
"ok",
"warning",
"critical",
"unknown"
@Seraf
Seraf / remove_ec2_from_route53.py
Last active August 29, 2015 14:15
This script remove an ec2 instance from route53 providing an instance pattern if this instance does not exist in sensu (so this instance still no longer exist)
#!/usr/bin/env python2
# encoding: utf-8
#
# Authors:
# Julien Syx <julien@syx.fr>
#
# Dependencies:
# - python boto
#
# On Debian: aptitude install python-boto
@Seraf
Seraf / register_ec2_to_route53.py
Created February 10, 2015 16:03
Register automatically an ec2 instance to route 53. The domain is pushed with DHCP option and is stored in the resolv.conf file
#!/usr/bin/env python
import urllib2
import boto
import logging
import socket
logger = logging.getLogger(__name__)
handler = logging.FileHandler('/var/log/route53.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
@Seraf
Seraf / ec2_tags.rb
Last active August 29, 2015 14:10
ec2 tags to facts. It requires aws-cli (pip install aws-cli)
require 'facter'
require 'json'
instance_id = Facter.value("ec2_instance_id")
region = Facter.value("ec2_placement_availability_zone")[0..-2]
tags = Facter::Util::Resolution.exec("/usr/local/bin/aws ec2 describe-tags --filters \"Name=resource-id,Values=#{instance_id}\" --region #{region} | cut -f 4-")
parsed_tags = JSON.parse(tags)
parsed_tags['Tags'].each do |tag|
Facter.add("ec2_tag_#{tag["Key"]}") do
@Seraf
Seraf / lisa-vhost
Created October 5, 2014 20:45
Vhost to proxify LISA
server {
listen 80;
root /usr/share/nginx/html;
index index.html index.htm;
server_name lisa;
location / {
proxy_pass http://lisa:8000/;
@Seraf
Seraf / terminal
Created July 15, 2014 14:53
Angularjs LISA
# Clone the repo
╭─julien@tagada-work ~/Sandbox/
╰─➤ git clone git@github.com:Seraf/LISA.git
╭─julien@tagada-work ~/Sandbox/
╰─➤ cd LISA
# Go to angularjs branch
╭─julien@tagada-work ~/Sandbox/LISA ‹master*›
╰─➤ git checkout angularjs
@Seraf
Seraf / gist:11367851
Last active August 29, 2015 14:00
LISA Install instructions
sudo apt-get install mongodb python-setuptools libxslt1-dev libxslt1.1 libxml2-dev build-essential python-dev libssl-dev python-openssl libyaml-dev
sudo easy_install pip
sudo pip install virtualenv virtualenvwrapper
sudo useradd -s /bin/bash -m lisa
sudo su - lisa
export WORKON_HOME=$HOME/.virtualenvs
echo "export WORKON_HOME=$HOME/.virtualenvs" >> ~/.bashrc
export PROJECT_HOME=$HOME/
echo "export PROJECT_HOME=$HOME/" >> ~/.bashrc
source /usr/local/bin/virtualenvwrapper.sh
@Seraf
Seraf / lisa-server.init
Created April 14, 2014 09:04
LISA Server Daemon
#! /bin/sh
### BEGIN INIT INFO
# Provides: lisa-server
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop Lisa server
### END INIT INFO