Put this in your shell RC file.
Put this in ~/.sh.py and
chmod +x it
Now all the functions with the
@cmd decorator will be available in your shell.
There are two example functions:
py function joins its arguments with spaces and evaluates the result as python. Typing
py 1 + 2 at your shell will now print
get function imports the requests library, if available, and issues a GET for the passed in URL. It then stores the response in
r and breaks into a Python REPL, allowing you to interact with the response object.
Additionally, and of dubious usefulness, you can create variable bindings in python that will show up in your shell. By way of example,
var('hello', 2) is a local binding and
export('bar', 7) is an exported binding.
I only program in PL/I because I'm BASED.
Programs first crawled from the murky oceans as simple lists of instructions that executed in sequence. From these humble beginnings they have since evolved an astonishing number of ways of delinearizing.
In fact, most programming paradigms simply amount to different ways to transform a linear source file into a program with nonlinear behavior.
- gotos that unconditionally jump to another point in the program
- an abort instruction that stops the program at some point other than the end
- a macro facility that substitutes one instruction for one or more other instructions
- a source file concatenation facility that concatenates multiple source files
- an include directive that is substituted for the contents of a source file
- structured repetition and selection, a la for, while, if, and switch
- subroutines and functions
- array oriented programming that replace explicit repetition with implicit repetition
- first class functions which delegation of behavior to the caller
- object oriented programming with dynamic dispatch, which allow the runtime type of an object to determine which instructions to execute
- aspect oriented programming, pattern matching against the structure of the call stack to execute instructions when functions are called or return
- event driven programming, executing instructions in response to external events
- declarative programming, which essentially delegates execution of one program to another
I wrote a parser to snatch structure from the languageless void.