Skip to content

Instantly share code, notes, and snippets.

View mrwalruss's full-sized avatar
😅
(づ。◕‿‿◕。)づ

mrwalruss

😅
(づ。◕‿‿◕。)づ
View GitHub Profile

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@mrwalruss
mrwalruss / integer.rb
Created August 25, 2022 02:52 — forked from pithyless/integer.rb
Ruby Integer::MAX and Integer::MIN
class Integer
N_BYTES = [42].pack('i').size
N_BITS = N_BYTES * 16
MAX = 2 ** (N_BITS - 2) - 1
MIN = -MAX - 1
end
p Integer::MAX #=> 4611686018427387903
p Integer::MAX.class #=> Fixnum
p (Integer::MAX + 1).class #=> Bignum
#!/bin/sh
apk add stunnel redis openssl gcc
# Remember to replace the host and port
cat > /etc/stunnel/redis-cli.conf <<EOF
fips = no
setuid = root
setgid = root
pid = /var/run/stunnel.pid
@mrwalruss
mrwalruss / pre-commit
Created December 8, 2021 06:00
Rubocop pre-commit git hook.
# .git/hook/pre-commit
#!/bin/sh
#
# Check for ruby style errors
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
NC='\033[0m'
@mrwalruss
mrwalruss / web-servers.md
Created March 11, 2020 11:05 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@mrwalruss
mrwalruss / rails http status codes
Created August 19, 2019 11:55 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@mrwalruss
mrwalruss / macos_mojave_no_sound.sh
Created August 9, 2019 03:57 — forked from nnluukhtn/macos_mojave_no_sound.sh
Fix macOS Mojave no sound
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`
@mrwalruss
mrwalruss / rails_console_auto_reload.rb
Created July 19, 2018 08:24 — forked from stevenberg/rails_console_auto_reload.rb
Automatic Reloading in Rails Console
# http://jkfill.com/2012/12/08/automatic-code-reloading-in-rails-console
# put this in config/initializeers/irb_reloading.rb
if defined?(IRB::Context) && !defined?(Rails::Server) && Rails.env.development?
class IRB::Context
def evaluate_with_reloading(line, line_no)
reload!(true)
evaluate_without_reloading(line, line_no)
end

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: