Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View blasterpal's full-sized avatar

Hank Beaver blasterpal

View GitHub Profile
@blasterpal
blasterpal / elastic_apm_sidekiq_error.txt
Created July 2, 2020 17:51
Elastic APM Gem error related to Sidekiq when running Rails console or Rails server.
# To prevent:
# ENV['ELASTIC_APM_DISABLE_INSTRUMENTATIONS'] = "json,sidekiq"
[DEPRECATED] The option active has been renamed to enabled to align with other agents and with the remote config.
Traceback (most recent call last):
99: from bin/rails:10:in `<main>'
98: from /Users/hbeaver/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
97: from /Users/hbeaver/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
96: from /Users/hbeaver/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
95: from /Users/hbeaver/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
@blasterpal
blasterpal / sandbox_ecs_task_role_secrets_test.js
Created June 11, 2020 18:15
Sandbox DocAPI Secrets test
// NODE_ENV=production node inspect dist/server.js
var AWS = require('aws-sdk');
var secretsmanager = new AWS.SecretsManager();
console.log(secretsmanager.config);
var params = {
SecretId: process.env.DOCUMENT_API_KEY
};
secretsmanager.getSecretValue(params, function(err, data) {
@blasterpal
blasterpal / example_graylog_regex.txt
Created April 21, 2020 20:50
Graylog Regex search
source:atldockerhaproxy* AND time_backend_response:/[6-9][0-9][0-9][0-9][0-9]/ AND request_header_host:/s.*enable.*/
@blasterpal
blasterpal / sed_print_matched_group.sh
Last active April 21, 2020 20:41
Print a matched group from a file using sed
cat graylog-search-result-relative-604800.csv | while read line
do
echo $line | sed -n -r 's/.*db":([0-9]*\.[0-9]*).*/\1/p'
done
cat graylog-search-result-keyword-since-april3.csv | while read line
do
echo $line | sed -n -r 's/.*email":"([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,})",.*/\1/pi'
done
@blasterpal
blasterpal / test_secrets_aws.js
Created April 6, 2020 19:10
Test JS Secret in Node
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
region: process.env.AWS_REGION
});
var secretsmanager = new AWS.SecretsManager();
@blasterpal
blasterpal / test_email.rb
Created November 17, 2010 15:36
Plain SMTP Email-Relay Test script
require 'net/smtp'
message = <<MESSAGE_END
From: Hank Beaver <hbeaver@maxmedia.com>
To: Hank Beaver <hbeaver@gmail.com>
Subject: SMTP e-mail test
This is a test e-mail message.
MESSAGE_END
@blasterpal
blasterpal / enc-dec-crypto-example.js
Created December 23, 2019 18:05
enc-dec-crypto-example
/ Encrypt
const ciphertext = CryptoJS.AES.encrypt('a8f0840ce2388', process.env.JWT_SECRET);
console.log('ciphertext', ciphertext.toString());
// // Decrypt
const plaintext = CryptoJS.AES.decrypt(ciphertext.toString(), process.env.JWT_SECRET).toString(CryptoJS.enc.Utf8);
console.log('plaintext', plaintext);
@blasterpal
blasterpal / old_about_me.md
Created August 6, 2015 13:08
About Me - Ver 1

About me

I have worked in almost every area of IT and software: hardware, networking, security, consulting and development. I've been called a jack-of-all trades, another has suggested 'Web Architect' since I focus on the Web. I love everything related to the internet and the open-source technologies that support it. Everyday is an opportunity to learn something new.

While I've programmed in Bash, C, Java, Node.js, PHP, Python and others on Solaris to Linux, I've had an affinity to Ruby and Ruby on Rails since 2006. My project experience varies from small micro-sites, Fortune 500 marketing sites, SaaS applications, large real estate rental sites, and social media real-time television event sites. Also before 'DevOps' became a moniker, I began working between development teams and operations, helping get large architectural changes deployed smoothly. While Ruby and Rails are my goal-to tools of choice, I am not a one-trick pony. I've written Java to talk to legacy web services when nothing else will work

@blasterpal
blasterpal / thread_dump_sidekiq.sh
Created October 9, 2012 15:25
Thread dump all Sidekiq processes
ps -ef | grep sidek | grep -v grep | cut -c10-14 | grep -v tail| xargs kill -TTIN
@blasterpal
blasterpal / curl_http_status_code_check.sh
Created July 12, 2011 11:53
Curl HTTP Status code check
#!/bin/bash
#http://beerpla.net/2010/06/10/how-to-display-just-the-http-response-code-in-cli-curl/
if test -z "$1"
then
echo "No URL provided."
exit
fi