Skip to content

Instantly share code, notes, and snippets.

View dhenson02's full-sized avatar
🏠
Working from home

Deryck dhenson02

🏠
Working from home
View GitHub Profile
@dhenson02
dhenson02 / .mwrc
Last active December 23, 2022 16:21
Keep me from maxing out RAM
# in kB
export MINIMUM_AVAILABLE_MEMORY=1400000
if [ ! -e "${NOTIFICATION_SOUND_PATH}" ]; then
export NOTIFICATION_SOUND_PATH="/fun/notification-sound-memory-alarm.mp3";
if [ -z "${NOTIFICATION_SOUND_SOURCE}" ]; then
export NOTIFICATION_SOUND_SOURCE="https://proxy.notificationsounds.com/wake-up-tones/gentle-alarm-474/download/file-sounds-928-gentle-alarm.mp3";
fi
@dhenson02
dhenson02 / connect.js
Last active June 27, 2021 08:16
Promisify HTTPS connections with vanilla Node
const https = require('https');
const defaultOptions = {
"port": 443,
"host": `127.0.0.1`,
"method": `GET`,
"headers": {
"Content-Type": `application/json`,
"Accept": `application/json`,
}
@dhenson02
dhenson02 / docker-compose.yml
Created April 4, 2020 03:06
Elasticsearch, Logstash, Kibana (ELK) stack docker-compose.yml (defaults, portable, no setup/config)
version: '3'
services:
es1:
image:
"docker.elastic.co/elasticsearch/elasticsearch:7.6.0"
ports:
- "9200:9200"
- "9300:9300"
environment:
- "discovery.type=single-node"
@meilinger
meilinger / logstash-filebeat-5-minutes.md
Last active June 26, 2023 12:03
Logstash and Filebeat in 5 minutes

Logstash and Filebeat in 5 minutes

What/Why?

  • Filebeat is a log shipper, capture files and send to Logstash for processing and eventual indexing in Elasticsearch
  • Logstash is a heavy swiss army knife when it comes to log capture/processing
  • Centralized logging, necessarily for deployments with > 1 server
  • Super-easy to get setup, a little trickier to configure
  • Captured data is easy to visualize with Kibana
  • Wny not just Logstash (ELK is so hot right now)?
/**
* Custom deep diffing to tell what changes throughout our data transfers
* Don't recommend for testing functions or recursively-nested objects (like Backbone collections).
* @param item1 <>
* @param item2 <>
* @param [isReversed] <Boolean>
* @returns <Array>(Object*)
*/
function deepDiff ( item1, item2, isReversed ) {
@htp
htp / curl-websocket.sh
Last active May 14, 2024 21:24
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@slashdotdash
slashdotdash / README.md
Last active April 9, 2019 12:52
React + D3 (v3)

Multi-series line chart rendered using React and D3.

@jeffcogswell
jeffcogswell / q_example.js
Last active August 12, 2022 01:22
Here's another chaining example on using q.js. This doesn't have any error handling, as I just want to demonstrate the chaining concept. Please read the comments carefully, as I start out with a non-q example, to show the order of flow. Please post comments if there's anything that isn't clear and I'll try to revise it as needed.
// Q sample by Jeff Cogswell
/*===========
We want to call these three functions in sequence, one after the other:
First we want to call one, which initiates an ajax call. Once that
ajax call is complete, we want to call two. Once two's ajax call is
complete, we want to call three.
BUT, we don't want to just call our three functions in sequence, as this quick
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 18, 2024 22:25
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'