Skip to content

Instantly share code, notes, and snippets.

View NickLaMuro's full-sized avatar
:bowtie:
probably definitely most likely rebasing...

Nick LaMuro NickLaMuro

:bowtie:
probably definitely most likely rebasing...
View GitHub Profile
@NickLaMuro
NickLaMuro / README.md
Created October 25, 2017 22:08
Memory Dump Analyzer

This is a adaptation of some of the ObjectSpace.dump_all analyisis scripts found in Sam Saffron's article on "Debugging memory leaks in Ruby":

https://samsaffron.com/archive/2015/03/31/debugging-memory-leaks-in-ruby

The input files are also generated in a similar fashion that is described in the blog post:

io=File.open("/tmp/my_dump", "w")
ObjectSpace.dump_all(output: io); 
@NickLaMuro
NickLaMuro / miq_server_mem_log_patch.local.rb
Created December 6, 2017 16:27
ManageIQ MiqServer mem log initializer patch
# Make sure the normal MiqServer is autoloaded before monkey patching it
MiqServer
require 'objspace'
class MiqServer < ApplicationRecord
alias _old_monitor_poll monitor_poll
def monitor_poll
begin
@NickLaMuro
NickLaMuro / compare_define_method_with_eval.rb
Created January 4, 2018 03:12
Comparing ruby's `define_method` to each type of `eval` for defining methods
# requires installing "benchmark-ips" (`$ gem install benchmark-ips`)
#
# Sample result
#
# $ ruby compare_define_method_with_eval.rb
# Warming up --------------------------------------
# using_define_method 17.203k i/100ms
# using_eval 29.526k i/100ms
# using_module_eval 30.355k i/100ms
# using_class_eval 30.809k i/100ms
@NickLaMuro
NickLaMuro / check_and_change_dns
Last active June 28, 2018 10:56
Dealing with Dynamic IP's with a home server and DNSimple
#!/bin/bash
EMAIL="your_email@example.com"
API_TOKEN="API_TOKEN"
DOMAIN_ID="your_domain.com"
RECORDS=(123456 234567 345678) # Replace with the Record ID
IP="`curl -s -S http://v4.ident.me`"
STORED_IP_ADDRESS_FILENAME="$HOME/.current_external_ip_address"
# Loop through each record id in the array
@NickLaMuro
NickLaMuro / example.out
Created July 31, 2019 00:56
Example of the .git_transaction feature in https://github.com/ManageIQ/manageiq/pull/19074
$ bin/rails r tmp/test_git_transaction.rb
** Using session_store: ActionDispatch::Session::MemCacheStore
** ManageIQ master, codename: J-release
starting...
creating record... done! (id: 21)
> Process 53627 has started...
> Process 53628 has started...
> Process 53629 has started...
> Process.53628: starting .git_transaction...
> Process.53629: starting .git_transaction...
@NickLaMuro
NickLaMuro / .vimrc
Last active December 31, 2021 02:29 — forked from napcs/.vimrc
Set up Vim on Mac or Linux. curl https://raw.github.com/gist/1147370/vim.sh | sh
"this is the cconfiguration file for linux and mac systems
"symlink this to your home folder as .vimrc
call pathogen#runtime_prepend_subdirectories(expand('~/.vim/bundles'))
call pathogen#helptags()
"call pathogen#runtime_append_all_bundles()
source ~/.vimrc_main
@NickLaMuro
NickLaMuro / .tmux.conf
Created January 27, 2012 07:27
My .tmux.conf
# # act like GNU screen
unbind C-b
set -g prefix C-a
# Allow C-A a to send C-A to application
bind C-a send-prefix
# start window index of 1
set -g base-index 1
@NickLaMuro
NickLaMuro / gitter-search.rb
Last active December 19, 2023 05:02
ruby script to search gitter archives (requires `oga` rubygem)
#!/usr/bin/env ruby
#
# gitter-search [--date YYYYMMDD] [--user @USERNAME] ORG/ROOM [PATTERN]
#
require 'oga'
require 'optparse'
require 'net/http'
options = {}