Skip to content

Instantly share code, notes, and snippets.

View skyrioloc's full-sized avatar
💻

Carmelo Riolo skyrioloc

💻
  • Sky Italia
  • Milan, Italy
View GitHub Profile
@skyrioloc
skyrioloc / pyscript.py
Created December 13, 2019 21:35 — forked from nhoffman/pyscript.py
Python script template
#!/usr/bin/env python
"""A simple python script template.
"""
from __future__ import print_function
import os
import sys
import argparse
@skyrioloc
skyrioloc / Twelve_Go_Best_Practices.md
Created October 17, 2019 21:49 — forked from pzurek/Twelve_Go_Best_Practices.md
Twelve Go Best Practices
fields @timestamp
| parse "MDW|*|*|*|*|*|*|*\"" as @servlet, @method, @url, @code, @startime, @endtime, @elapsed
| filter level == "INFO"
| filter message like "MDW|"
| sort @elapsed desc
| limit 20
######################### APM Server Configuration #########################
################################ APM Server ################################
apm-server:
# Defines the host and port the server is listening on. Use "unix:/path/to.sock" to listen on a unix domain socket.
host: "0.0.0.0:8200"
# Maximum permitted size in bytes of a request's header accepted by the server to be processed.
#max_header_size: 1048576
# Kibana is served by a back end server. This setting specifies the port to use.
#server.port: 5601
# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: "0.0.0.0"
# Enables you to specify a path to mount Kibana at if you are running behind a proxy.
# Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath
@skyrioloc
skyrioloc / create_elk_stack.sh
Last active October 17, 2019 21:41
ELK Scripts
#!/bin/bash
docker network create elastic
docker run -d --network elastic -p 9200:9200 -p 9300:9300 --name elasticsearch --restart=always -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.4.0
docker run -d --network elastic --name apm-server --restart=always -p 8200:8200 --user root -v /home/ec2-user/apm-server.docker.yml:/usr/share/apm-server/apm-server.yml:ro -e output.elasticsearch.hosts=["elasticsearch:9200"] docker.elastic.co/apm/apm-server:7.4.0
docker run -d -p 5601:5601 --name kibana --network elastic --restart=always -v /home/ec2-user/kibana.yml:/usr/share/kibana/config/kibana.yml kibana:7.4.0
@skyrioloc
skyrioloc / bobp-python.md
Created April 21, 2019 13:47 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@skyrioloc
skyrioloc / swagger-yaml-to-html.py
Created February 18, 2019 11:22 — forked from oseiskar/swagger-yaml-to-html.py
Converts Swagger YAML to a static HTML document (needs: pip install PyYAML)
#!/usr/bin/python
"""
Usage:
python swagger-yaml-to-html.py < /path/to/api.yaml > doc.html
"""
import yaml, json, sys
TEMPLATE = """
USERNAME [a-zA-Z0-9._-]+
USER %{USERNAME}
EMAILLOCALPART [a-zA-Z][a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILLOCALPART}@%{HOSTNAME}
INT (?:[+-]?(?:[0-9]+))
BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
NUMBER (?:%{BASE10NUM})
BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
def signature = 'method groovy.json.JsonBuilder call java.util.List'
org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.get().approveSignature(signature)