Skip to content

Instantly share code, notes, and snippets.

View petersooley's full-sized avatar
👾
Codin' away

Peter Sooley petersooley

👾
Codin' away
View GitHub Profile
@petersooley
petersooley / README.md
Last active April 22, 2025 14:34
NGINX TLS Termination for proxying TCP traffic to local RabbitMQ Service

NGINX TLS Termination for proxying TCP traffic to local RabbitMQ Service

This gist shows the necessary configurations to set up the TLS termination for TCP (not HTTP) traffic to the local RabbitMQ service running on localhost. This way, we're only managing certificates with NGINX and not setting up TLS certificates for RabbitMQ. NGINX listens for encrypted traffic on 0.0.0.0:5671, handles it, and proxies unencrypted traffic to the RabbitMQ services listening on localhost:5672.

reference TLS proxy reference

@petersooley
petersooley / hydrator.rs
Created December 31, 2020 02:38
Hydrating values from a database with function overloading in Rust
/// Getting values from a database often requires a transformation of raw
/// content into something suitable for your application. Using traits, I am
/// going to separate the low-level statements used to access database contents
/// and the transformation of that content into application values.
///
/// Rant: A common solution for this is to use an ORM which abstracts away
/// the database altogether. However, this has several downsides like not
/// being able to use the articulate and expressive language of the database
/// and also just dumbing down what you can do with the database.
@petersooley
petersooley / package.json
Last active September 2, 2021 23:47
Gander: screenshot grabber service
{
"name": "gander",
"version": "1.0.0",
"description": "Web service for getting screenshops of web sites",
"main": "server.js",
"scripts": {
"start": "node server.js",
"test": "npm run test"
},
"author": "Peter Sooley <peter.sooley@downstream.com>",
@petersooley
petersooley / trait-properties.php
Created May 17, 2018 22:13
Why does this work? If I use this, will it break in the future?
<?php
trait Logger {
protected $channel = 'base';
public function log($msg)
{
echo "[{$this->channel}] $msg\n";
}
}
@petersooley
petersooley / VexStep.coffee
Created June 9, 2014 18:00
This is a sample of how to customize vex into a series of configuration steps with an emphasis on using markup to define the steps. Just an example, not fully functional as is.
class Configuration
constructor: (@$form, @$input) ->
@data = {}
update: (id, formObj, callback) ->
if id == 'run'
@$input.val JSON.stringify @data
@$form.hide()
data =
@petersooley
petersooley / gist:6127673
Last active December 20, 2015 11:59
This is a jQuery plugin for determining the depth-first position of a child element.
// $('ul').depthPosition('li:nth-child(5)')
(($) ->
$.fn.depthPosition = (targetListItem) ->
count = 1
for child in @children()
if $(child).get(0) == $(targetListItem).get(0)
return count
else
childDepths = $(child).depthPosition(targetListItem)