Skip to content

Instantly share code, notes, and snippets.

View alazycoder101's full-sized avatar

Lazy coder alazycoder101

View GitHub Profile
@alazycoder101
alazycoder101 / docker-aliases.sh
Created October 20, 2024 22:45 — forked from jgrodziski/docker-aliases.sh
Useful Docker Aliases
############################################################################
# #
# ------- Useful Docker Aliases -------- #
# #
# # Installation : #
# copy/paste these lines into your .bashrc or .zshrc file or just #
# type the following in your current shell to try it out: #
# wget -O - https://gist.githubusercontent.com/jgrodziski/9ed4a17709baad10dbcd4530b60dfcbb/raw/d84ef1741c59e7ab07fb055a70df1830584c6c18/docker-aliases.sh | bash
# #
# # Usage: #
@alazycoder101
alazycoder101 / alias_matchers.md
Created April 11, 2024 18:42 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@alazycoder101
alazycoder101 / generate-wildcard-certificate.sh
Created July 9, 2023 22:42 — forked from dmadisetti/generate-wildcard-certificate.sh
Generate self-signed wildcard SSL certificate for development environment
#!/usr/bin/env bash
# print usage
DOMAIN=$1
if [ -z "$1" ]; then
echo "USAGE: $0 tld"
echo ""
echo "This will generate a non-secure self-signed wildcard certificate for "
echo "a given development tld."
echo "This should only be used in a development environment."
@alazycoder101
alazycoder101 / tcp-no-delay-benchmark.rb
Last active April 27, 2023 10:21 — forked from dylanahsmith/tcp-no-delay-benchmark.rb
Benchmarking Net::HTTP with and without keep-alive and TCP_NODELAY
#!/usr/bin/env ruby
require 'net/http'
require 'net/http/persistent' # gem install net-http-persistent
require 'benchmark'
class HttpNoTcpDelay < Net::HTTP
def on_connect
@socket.io.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
nil
@alazycoder101
alazycoder101 / installNeovim.sh
Created March 30, 2023 16:28 — forked from darcyparker/installNeovim.sh
Build and install neovim for Debian
#!/usr/bin/env bash
#Build and install neovim for Debian
#See: https://neovim.io/
#See: https://github.com/neovim/neovim/wiki/Building-Neovim#quick-start
#See: https://gist.github.com/darcyparker/153124662b05c679c417
#Save current dir
pushd . > /dev/null || exit
@alazycoder101
alazycoder101 / net_http_debug.rb
Created March 6, 2023 14:54 — forked from brainlid/net_http_debug.rb
Enable debug for all Ruby HTTP requests
require 'net/http'
module Net
class HTTP
def self.enable_debug!
raise "You don't want to do this in anything but development mode!" unless Rails.env == 'development'
class << self
alias_method :__new__, :new
def new(*args, &blk)
instance = __new__(*args, &blk)
instance.set_debug_output($stderr)
@alazycoder101
alazycoder101 / frag.rb
Created February 23, 2022 16:39 — forked from mperham/frag.rb
memory fragmentation on ruby 2.5.1
=begin
This script attempts to reproduce poor glibc allocator behavior within Ruby, leading
to extreme memory fragmentation and process RSS bloat.
glibc allocates memory using per-thread "arenas". These blocks can easily fragment when
some objects are free'd and others are long-lived.
Our script runs multiple threads, all allocating randomly sized "large" Strings between 4,000
and 40,000 bytes in size. This simulates Rails views with ERB creating large chunks of HTML
to output to the browser. Some of these strings are kept around and some are discarded.
@alazycoder101
alazycoder101 / ruby-jemalloc-check.sh
Created February 23, 2022 16:39 — forked from kigster/ruby-jemalloc-check.sh
Detect if MRI Ruby is built with jemalloc library or not, download with `curl -fSL http://bit.ly/ruby-jemalloc-check > ruby-jemalloc-check.sh`
#!/usr/bin/env bash
# vi: ft=sh
#
# © 2019 Konstantin Gredeskoul, Inc., All rights reserved.
# MIT LICENSE
#
# ————————————————————————————————————————————————————————————————
# This script verifies that the current ruby (in PATH) is linked
# with libjemalloc library for efficient memory utilization.
# It works identically on Linux and Mac OSX.