Skip to content

Instantly share code, notes, and snippets.

@jamesbjackson
jamesbjackson / View CollectD UDP packets
Last active August 13, 2021 15:48
View CollectD UDP packets
sudo tcpdump -i ens5 -n udp port 8125 -X
sudo tcpdump -i lo -n tcp port 2003 -X
######################################################################################################
# SignalFX RabbitMQ (https://github.com/signalfx/collectd-rabbitmq)
# See https://docs.signalfx.com/en/latest/integrations/agent/monitors/collectd-rabbitmq.html
######################################################################################################
# ------------------------------------------
# Channel Counters (counter.channel)
# ------------------------------------------
counter.channel.message_stats.ack value:COUNTER:0:U # The number of acknowledged messages
counter.channel.message_stats.confirm value:COUNTER:0:U # Count of messages confirmed.
@jamesbjackson
jamesbjackson / nginx_logging.conf
Last active April 14, 2021 10:17
Nginx Log JSON Formatting
log_format main_json escape=json '{'
'"msec": "$msec", ' # request unixtime in seconds with a milliseconds resolution
'"connection": "$connection", ' # connection serial number
'"connection_requests": "$connection_requests", ' # number of requests made in connection
'"request_id": "$request_id", ' # the unique request id
'"request_length": "$request_length", ' # request length (including headers and body)
'"remote_addr": "$remote_addr", ' # client IP
'"remote_user": "$remote_user", ' # client HTTP username
'"remote_port": "$remote_port", ' # client port
'"date_gmt": "$date_gmt", ' # current time in GMT. The format is set by the config command with the timefmt parameter
@jamesbjackson
jamesbjackson / cross_resource_group_deployement_snippet.json
Created July 5, 2017 14:36
An Example of how to do a cross resource group deployment using Microsoft Azure ARM Templates.
{
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
@jamesbjackson
jamesbjackson / kubernetes_reading_list
Last active November 11, 2020 19:19
Reading list arround Kubernetes
Kubernetes Learning Resources
-----------------------------
50 days from zero to hero with Kubernetes (Free Video Content) by Microsoft
https://azure.microsoft.com/mediahandler/files/resourcefiles/kubernetes-learning-path/Kubernetes%20Learning%20Path_Version%202.0.pdf
@jamesbjackson
jamesbjackson / dump_route53_records.md
Last active August 14, 2020 10:29 — forked from porjo/dump_route53_records.md
Export route53 records to TSV & CSV

Retrieve hosted zones with aws route53 list-hosted-zones then enter the zone Id below:

TSV

aws route53 list-resource-record-sets --hosted-zone-id "/hostedzone/xxxxxxxxxxx" | jq -r '.ResourceRecordSets[] | [.Name, .Type, (.ResourceRecords[]? | .Value), .AliasTarget.DNSName?]  | @tsv'

CSV

# Find out what process is using all the RAM?
ps -e -o pid,vsz,comm= | sort -n -k 2
# clear page cache only without interrupting any processes or services. (Run as Root)
sync; echo 1 > /proc/sys/vm/drop_caches
# clear dentries and inodes only without interrupting any processes or services. (Run as Root)
sync; echo 2 > /proc/sys/vm/drop_caches
# clear page cache, dentries and inodes only without interrupting any processes or services. (Run as Root)
erb -x -T '-' file.erb | ruby -c
git remote add upstream https://github.com/ORIGINAL_OWNER/REPOSITORY.git
git remote -v
origin https://github.com/USERNAME/REPOSITORY.git (fetch)
origin https://github.com/USERNAME/REPOSITORY.git (push)
upstream https://github.com/ORIGINAL_OWNER/REPOSITORY.git (fetch)
upstream https://github.com/ORIGINAL_OWNER/REPOSITORY.git (push)
git fetch upstream
git checkout master
git rebase upstream/master
nping -c 1 --tcp -p 80 10.10.10.1
Starting Nping 0.7.80 ( https://nmap.org/nping ) at 2020-01-29 16:53 GMT
SENT (0.0141s) TCP 192.168.1.221:5991 > 10.10.10.1:80 S ttl=64 id=35587 iplen=40 seq=1474941899 win=1480
RCVD (0.3046s) TCP 10.10.10.1:80 > 192.168.1.221:5991 SA ttl=37 id=0 iplen=44 seq=3029599029 win=11520 <mss 582>
Max rtt: 290.255ms | Min rtt: 290.255ms | Avg rtt: 290.255ms
Raw packets sent: 1 (40B) | Rcvd: 1 (46B) | Lost: 0 (0.00%)
Nping done: 1 IP address pinged in 1.02 seconds