Skip to content

Instantly share code, notes, and snippets.

View palazzem's full-sized avatar

Emanuele Palazzetti palazzem

  • Former Director of Engineering @DataDog
  • Paris, France
View GitHub Profile
@palazzem
palazzem / settings.json
Created March 23, 2023 15:11 — forked from MaxAtoms/settings.json
Visual Studio Code/Code-OSS settings and extensions backup
{
"window.titleBarStyle": "custom",
"workbench.colorTheme": "Night Owl",
"git.autofetch": true,
"terminal.integrated.fontFamily": "'Fira Code'",
"editor.minimap.enabled": false,
"docker.groupImagesBy": "None",
"editor.fontFamily": "'Fira Code', 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'",
"editor.fontLigatures": true,
"window.title": "${dirty}${activeEditorMedium}${separator}${rootName}${separator}${appName}",
@palazzem
palazzem / docker-compose.yml
Created March 22, 2020 17:17
Traefik in network_mode: host
version: "3.7"
services:
traefik:
image: "traefik:v2.2"
container_name: "traefik"
command:
- "--accesslog=true"
- "--api.insecure=true"
- "--entrypoints.web.address=:80"
@palazzem
palazzem / agent-install.sh
Last active January 9, 2020 13:58
Datadog Agent ARMv7 post-build
# Install the Datadog Agent
mkdir -p /opt/datadog-agent/
mkdir -p /var/log/datadog/
mv ~/agent-armv7-package/agent /opt/datadog-agent/
mv ~/agent-armv7-package/dist /opt/datadog-agent/
mv ~/agent-armv7-package/datadog-agent /etc/
# Create dd-agent user and set permissions
addgroup dd-agent
adduser --system --no-create-home --disabled-password --ingroup dd-agent dd-agent
@palazzem
palazzem / pygotham_talk_handler.py
Created October 5, 2017 23:46
pygotham_talk_handler.py
class Handler(object):
async def handle_request(self, request):
# set the current context
ctx = {}
set_current_context(ctx)
ctx['username'] = request.get('username', 'Anonymous')
result = await retrieve_user_data()
return result
@palazzem
palazzem / pygotham_asyncio_full_app.py
Created October 5, 2017 23:42
pygotham_asyncio_full_app.py
import asyncio
def set_current_context(ctx, loop=None):
# retrieves the current Task
loop = loop or asyncio.get_event_loop()
task = asyncio.Task.current_task(loop=loop)
# attach the Context to the task!
setattr(task, '__current_ctx', ctx)
@palazzem
palazzem / datadog_kickstarter_metrics.py
Created May 25, 2017 11:15
[datadog] kickstarter_metrics.py
import requests
from datetime import datetime, timedelta
from datadog import initialize, statsd
options = {
'api_key':'your_datadog_key_here',
}
# don't use a trailing slash
@palazzem
palazzem / keybase.md
Created May 21, 2017 16:52
keybase.md

Keybase proof

I hereby claim:

  • I am palazzem on github.
  • I am palazzem (https://keybase.io/palazzem) on keybase.
  • I have a public key ASCRinl2svThLRKvJf0vYiwH9MD2-ReufZWfDBN5uVvMIwo

To claim this, I am signing this object:

@palazzem
palazzem / pygotham_context_propagator.py
Last active October 5, 2017 23:47
pygotham_context_propagator.py
import asyncio
def set_current_context(ctx, loop=None):
# retrieves the current Task
loop = loop or asyncio.get_event_loop()
task = asyncio.Task.current_task(loop=loop)
# attach the Context to the task!
setattr(task, '__current_ctx', ctx)
def get_current_context(loop=None):
@palazzem
palazzem / server.py
Created March 31, 2017 14:22 — forked from ross/server.py
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, \
unicode_literals
from concurrent.futures import ThreadPoolExecutor
from ddtrace import tracer
from ddtrace.contrib.tornado import trace_app
from random import uniform
from time import sleep
#!/bin/bash
VENV=$1
if [ -z $VENV ]; then
echo "usage: runinenv [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
if [ -f ${VENV}/bin/postactivate ]; then
. ${VENV}/bin/postactivate