Skip to content

Instantly share code, notes, and snippets.

View labbati's full-sized avatar
🐢
It works on my laptop 🐢

Luca Abbati labbati

🐢
It works on my laptop 🐢
View GitHub Profile
from datadog import initialize, statsd
import datetime
import time
import random
ENV = "demo"
SERVICE = "inventory-api"
# Was not able to get it to work from MAC to containerized agent
initialize(statsd_host='agent', statsd_port=8125)
@labbati
labbati / execute cli fgci request
Last active March 31, 2022 20:38
PHP-FPM from CLI
REQUEST_URI=/ \
SCRIPT_FILENAME=/var/www/html/public/index.php \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect 127.0.0.1:9000
@labbati
labbati / tcurl
Last active April 21, 2020 10:07
#!/usr/bin/env bash
read -r -d '' TIMING_COMMAND <<- EOM
-------------------------------
time_namelookup: %{time_namelookup}s
time_connect: %{time_connect}s
time_appconnect: %{time_appconnect}s
time_pretransfer: %{time_pretransfer}s
time_redirect: %{time_redirect}s
time_starttransfer: %{time_starttransfer}s
@labbati
labbati / index.php
Created October 17, 2019 12:50
PHP without composer
<?php
// Manually enable manual instrumentation
if (file_exists($hook = ini_get('ddtrace.request_init_hook'))) {
include dirname($hook) . '/dd_init.php';
}
// Your code here
echo "Hi!\n";
@labbati
labbati / local-build.sh
Last active January 25, 2019 14:18
Build packages for dd-trace
#!/usr/bin/env bash
rm -rf extensions
mkdir -p extensions
rm -rf build/packages
mkdir -p build/packages
function build_version() {
PHP_VERSION=$1
@labbati
labbati / instrumented-php-server.sh
Last active January 24, 2019 10:54
Run an instrumented PHP script
DD_TRACE_DEBUG=true DD_AGENT_HOST=agent php -d error_log=/dev/stderr -d 'ddtrace.request_init_hook=/home/circleci/app/bridge/dd_wrap_autoloader.php' -S 0.0.0.0:6789 app_dev.php
@labbati
labbati / gone-branches.sh
Created December 14, 2018 09:25
List all local branches that have a remote that was there but has been removed.
#!/usr/bin/env bash
git fetch -p && git branch -vv | grep ": gone]"