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 / 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 / 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 / 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 / gh_audit_parsing_report.rb
Created April 24, 2018 17:10
Ruby script to parse GH audit download
require 'json'
require 'pry'
require 'active_support'
require 'date'
require 'csv'
class GHAudit
def initialize
@file = File.open('./gh_audit.json','r')
@blasterpal
blasterpal / com.hankbeaver.dockerformacloopback.plist
Created May 11, 2017 20:09
Docker For Mac Loopback adapter MacOS LaunchAgent script
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.hankbeaver.DockerForMacLoopBack</string>
<key>ProgramArguments</key>
<array>
<string>/System/Library/CoreServices/Spotlight.app/Contents/MacOS/Spotlight</string>
</array>
@blasterpal
blasterpal / bigquery_semantic_gh_metadata.rb
Last active April 30, 2017 19:18
Script to merge results from BigQuery Github Dataset with GitHub meta data
#Gemfile contents
source "https://rubygems.org"
gem 'octokit'
gem "pry"
# END Gemfile
require 'rubygems'
require 'bundler/setup'
require 'octokit'
require 'csv'
@blasterpal
blasterpal / bigquery_semantic_distinct.sql
Created April 30, 2017 19:11
BigQuery Github Semantic UI Temp Table DISTINCT/GROUP BY Query
SELECT sample_repo_name from [bigquery-semantic-ui-work:semantic_ui_bigquery_fun.semantic_all_repo_results] GROUP BY sample_repo_name