Skip to content

Instantly share code, notes, and snippets.

@thoward
thoward / iptables-udp-flood.txt
Created August 8, 2013 00:04
Prevent UDP flood
# Outbound UDP Flood protection in a user defined chain.
iptables -N udp-flood
iptables -A OUTPUT -p udp -j udp-flood
iptables -A udp-flood -p udp -m limit --limit 50/s -j RETURN
iptables -A udp-flood -j LOG --log-level 4 --log-prefix 'UDP-flood attempt: '
iptables -A udp-flood -j DROP
@thoward
thoward / MultiTokenStreamExample.Program.cs
Created December 17, 2010 03:33
An example of how to do something like Solr's copy fields in a Lucene Index...
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Documents;
using Lucene.Net.Index;
using Lucene.Net.QueryParsers;
@thoward
thoward / neo4j-metrics-example-output.txt
Created April 22, 2022 01:27
Example output from Neo4j metrics endpoint.
# HELP neo4j_system_cypher_replan_events_total Generated from Dropwizard metric import (metric=neo4j.system.cypher.replan_events, type=com.neo4j.metrics.metric.MetricsCounter)
# TYPE neo4j_system_cypher_replan_events_total counter
neo4j_system_cypher_replan_events_total 0.0
# HELP neo4j_system_db_query_execution_failure_total Generated from Dropwizard metric import (metric=neo4j.system.db.query.execution.failure, type=com.codahale.metrics.Meter)
# TYPE neo4j_system_db_query_execution_failure_total counter
neo4j_system_db_query_execution_failure_total 0.0
# HELP neo4j_system_transaction_active_write Generated from Dropwizard metric import (metric=neo4j.system.transaction.active_write, type=com.neo4j.metrics.source.db.TransactionMetrics$$Lambda$1093/0x0000000800982840)
# TYPE neo4j_system_transaction_active_write gauge
neo4j_system_transaction_active_write 0.0
# HELP neo4j_vm_pause_time Generated from Dropwizard metric import (metric=neo4j.vm.pause_time, type=com.neo4j.metrics.source.jvm.PauseMetrics$$Lambda$14
@thoward
thoward / envoy-metrics-example-output.txt
Last active April 21, 2022 23:49
Example output from Envoy metrics endpoint.
# TYPE envoy_cluster_assignment_stale counter
envoy_cluster_assignment_stale{envoy_cluster_name="service_envoyproxy_io"} 0
# TYPE envoy_cluster_assignment_timeout_received counter
envoy_cluster_assignment_timeout_received{envoy_cluster_name="service_envoyproxy_io"} 0
# TYPE envoy_cluster_bind_errors counter
envoy_cluster_bind_errors{envoy_cluster_name="service_envoyproxy_io"} 0
# TYPE envoy_cluster_client_ssl_socket_factory_downstream_context_secrets_not_ready counter
@thoward
thoward / cockroachdb-metrics-example-output.txt
Created April 21, 2022 22:38
Example output from CockroachDB metrics endpoint.
# HELP sql_txn_begin_count_internal Number of SQL transaction BEGIN statements successfully executed (internal queries)
# TYPE sql_txn_begin_count_internal counter
sql_txn_begin_count_internal 0
# HELP queue_replicate_transferlease Number of range lease transfers attempted by the replicate queue
# TYPE queue_replicate_transferlease counter
queue_replicate_transferlease{store="1"} 0
# HELP gossip_connections_refused Number of refused incoming gossip connections
# TYPE gossip_connections_refused counter
gossip_connections_refused 0
# HELP sqlliveness_is_alive_cache_hits Number of calls to IsAlive that return from the cache
@thoward
thoward / caddy-metrics-example-output.txt
Created April 21, 2022 22:02
Example output from Caddy Webserver metrics endpoint
# HELP caddy_admin_http_requests_total Counter of requests made to the Admin API's HTTP endpoints.
# TYPE caddy_admin_http_requests_total counter
caddy_admin_http_requests_total{code="200",handler="metrics",method="GET",path="/metrics"} 3
# HELP caddy_http_request_duration_seconds Histogram of round-trip request durations.
# TYPE caddy_http_request_duration_seconds histogram
caddy_http_request_duration_seconds_bucket{code="200",handler="encode",method="GET",server="srv0",le="0.005"} 1
caddy_http_request_duration_seconds_bucket{code="200",handler="encode",method="GET",server="srv0",le="0.01"} 1
caddy_http_request_duration_seconds_bucket{code="200",handler="encode",method="GET",server="srv0",le="0.025"} 1
caddy_http_request_duration_seconds_bucket{code="200",handler="encode",method="GET",server="srv0",le="0.05"} 1
caddy_http_request_duration_seconds_bucket{code="200",handler="encode",method="GET",server="srv0",le="0.1"} 1
@thoward
thoward / docker-metrics-example-output.txt
Created April 21, 2022 21:01
Example of Docker metrics output
# HELP builder_builds_failed_total Number of failed image builds
# TYPE builder_builds_failed_total counter
builder_builds_failed_total{reason="build_canceled"} 0
builder_builds_failed_total{reason="build_target_not_reachable_error"} 0
builder_builds_failed_total{reason="command_not_supported_error"} 0
builder_builds_failed_total{reason="dockerfile_empty_error"} 0
builder_builds_failed_total{reason="dockerfile_syntax_error"} 0
builder_builds_failed_total{reason="error_processing_commands_error"} 0
builder_builds_failed_total{reason="missing_onbuild_arguments_error"} 0
builder_builds_failed_total{reason="unknown_instruction_error"} 0
@thoward
thoward / untar.sh
Created March 20, 2013 01:08
Simple untar script that does the obvious thing and creates a directory named after the tar file, then extracts a tar in that directory. This is a handy to install in user scope to augment tar.
#/bin/bash
# cross platform absolute path function
abspath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
outd=`abspath ``basename $1 .tgz```
target=`abspath $1`
@thoward
thoward / nested-lists.css
Created June 14, 2017 02:44
Nested Lists CSS: Correct behavior for nested lists at all levels, up to 6 deep. ULs alternate from disc/square. OLs: decimal, upper-alpha, lower-roman, lower-alpha, upper-roman
/* 1st level */
ul li {
list-style-type: disc;
}
ol li {
list-style-type: decimal;
}
/* 2nd level */
ul li ul li {
@thoward
thoward / oscon-2014-group-bike-ride.md
Last active March 28, 2017 00:08
OSCON 2014 Group Bike Ride

OSCON 2014 Group Bike Ride

Love bikes and open source? In town for OSCON 2014? Join us for a group ride.

bike pic

WHEN

Wednesday, July 23rd 2014 at 6:00pm