Skip to content

Instantly share code, notes, and snippets.

View klappradla's full-sized avatar

Max Mulatz klappradla

View GitHub Profile
@klappradla
klappradla / np_example.sh
Created May 14, 2020 22:38
Minimal example to explore custom versions problem with np
#!/bin/sh
set -o errexit
set -o nounset
# Create directory
mkdir example && cd example
# Initialize Git repository
git init && git commit --allow-empty -m "init commit"
@klappradla
klappradla / downgrade_tmux.md
Last active June 17, 2022 07:40
Downgrade homebrew's tmux to 2.9a

Downgrade tmux installed via homebrew to v 29.a.

Uninstall current version and install from the old formula:

brew uninstall tmux
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/c8cff106b17b90472cc6e251b9e5c2daf4fd8d46/Formula/tmux.rb

Pin the version to prevent it from accidental upgrades:

@klappradla
klappradla / validation_example.rb
Created August 6, 2017 12:00
Single file rails app to illustrate acceptance only validations
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
@klappradla
klappradla / procs_vs_lambdas.md
Last active October 21, 2016 21:27
Procs vs. Lambdas (example)

Procs vs. Lambdas

Seem the same:

[1] pry(main)> pr = proc { p "Hi" }
=> #<Proc:0x007fdc7a1398f0@(pry):8>
[2] pry(main)> lam = -> { p "Hi" }
=> #<Proc:0x007fdc79c53110@(pry):9 (lambda)>
[3] pry(main)> pr.class
@klappradla
klappradla / homebrew_fix_updates.sh
Created September 20, 2016 16:47
Reset Homebrew if updates are no longer working
cd `brew --prefix`
git fetch origin
git reset --hard origin/master
@klappradla
klappradla / debugging_in_jruby.md
Last active March 22, 2024 12:10
Debugging in JRuby

Debugging in JRuby

Step-by-step debugging and stack navigation for JRuby code.

Problem: the common tools byebug and pry-byebug are MRI-only.

Prerequisites

Force JRuby to run in fully interpreted mode:
(otherwise next would behave like step)

@klappradla
klappradla / brew_spring_cleanup.sh
Created August 10, 2016 22:03
Homebrew spring cleanup
# check if a formula is still needed
brew uses —installed formula
@klappradla
klappradla / rubyracer.sh
Created August 9, 2016 14:16
Install rubyracer gem (v. 0.12.0)
brew install v8-315
bundle config --local build.libv8 --with-system-v8
bundle config --local build.therubyracer --with-v8-dir=/usr/local/opt/v8-315
bundle install
@klappradla
klappradla / cassandra12.sh
Last active August 4, 2016 13:10
Install Cassandra v.1.2 on OSX
# Install Cassandra version 1.2.9
mkdir ~/tmp
cd ~/tmp
curl -O http://archive.apache.org/dist/cassandra/1.2.9/apache-cassandra-1.2.9-bin.tar.gz
tar -xzf apache-cassandra-*
rm -rf *.tar.gz
# Create cassandra lib/log directory and grant access to it?
sudo mkdir /var/lib/cassandra
sudo mkdir /var/log/cassandra
@klappradla
klappradla / docker.sh
Last active August 21, 2016 11:00
Stop and remove all Docker containers (running or not), interactive console in container
# Stop and remove all docker containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
# Run an interative console (like byebug or pry)
docker-compose run --service-ports appname