Skip to content

Instantly share code, notes, and snippets.

View srm's full-sized avatar

Sam McLaughlin srm

View GitHub Profile
@timm
timm / for.lisp
Created February 25, 2012 04:01
LUA for loops (in LISP)
#|
The LUA programming language supports iterators.
The LUA for loop takes some generate function and asks it to
produce a function that can return the next item.
A loop is then entered. The next item is generated. If it
is non-nil, then the body of the loop is called to consume
that item.
@JosephPecoraro
JosephPecoraro / shell-execution.rb
Last active March 19, 2025 06:46
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111