Ruby Equivalent of Popular Pythings
pygments-pymentize to rouge-rougify
When working with text based user interfaces (TUI/CLI), a wall of black-and-white text makes things harder. Add colors with syntax highlighting, and it makes the text much more discernible. Depending on which programming language you are working with, there’s usually a popular library native to the programming language you are working with - for Python, there’s Pygments; for PHP, there’s Geshii; and, for Ruby, there’s Rouge.
To install Pygments, we use the Python package mamanger pip and we then invoke pygmentize by passing a filename as an argument like this:
python3 -m pip install pygments
pygmentize mydata.json
The Ruby equivalent is to use either bundler
or gem
to install the package, and to invoke rougify with the filename as a parameter:
gem install rouge
rougify mydata.json
http.server to webrick
When you want to share files with somebody, the easiest way is to start a web server and share the URL to it. Python includes an HTTP server, and is commonly used by system administrators as an alternative to scp
to move files around with curl
or wget
or a web browser.
sudo python3 -m http.server 80 # the 80 indicates the port number; when omitted, it uses port 8000
Old versions of Ruby included the webrick HTTP server, but it’s easy to install it with gem
. Webrick defaults to port 8080, but we can change it to port 80 just as easily.
gem install webrick
sudo ruby -e httpd -run -p 80
Ansible/Salt to Puppet/Chef
Ansible is used to perform deployments and make configuration changes without having to install an agent on the remote servers - it uses SSH to connect and perform operations with ansible-playbook <filename.yml>
. SaltStack is another popular Python-based DevOps tool that supports both agent-less and with-agent deployments and configuration changes.
Puppet is used for a similar purpose, but requires an agent to be installed. Puppet can also be used to apply changes locally by using puppet-apply <filename.pp>
. Chef is another Ruby-based equivalent.