Created
October 11, 2013 20:18
-
-
Save ThomasHintz/6941360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require-extension ansi-escape-sequences srfi-19 srfi-1 srfi-13 posix) | |
(define (reload-config) (load "~/.hiss")) | |
(define-syntax install (syntax-rules () ((sudo arg1 ...) (_raw sudo apt-get install arg1 ...)))) | |
(define-syntax ! (syntax-rules () ((! arg1 ...) (_raw arg1 ...)))) | |
(define-syntax apt-search (syntax-rules () ((apt-search arg1 ...) (_raw aptitude search arg1 ...)))) | |
(define ++ string-append) | |
(define (search-dir text) | |
(run (++ "find . \\( -path \\*/.git -o -path \\*/.metadata \\) -prune -o -print0 | xargs -0 -e grep -i -e '" text "'"))) | |
(define (list->string l) (fold (lambda (e o) (++ o e)) "" l)) | |
(define (search s l) | |
(filter (lambda (e) (string-contains-ci e s)) l)) | |
(define (play-music p) (run (++ "mplayer -cache 1000 -cache-min 80 " p))) | |
(define pm play-music) | |
(define cd change-directory) | |
(define pwd current-directory) | |
(define mkdir create-directory) | |
(define ls directory) | |
(define rm delete-file*) | |
(define (cp file dest) (_ "cp" file dest)) | |
(define (cat file) (_ "cat" file)) | |
(define (ps-find s) (pp (search s (_ "ps -A")))) | |
(repl-prompt | |
(lambda () | |
(let ((is-root? (lambda (user) (string=? user "root"))) | |
(user (car (user-information (current-user-id))))) | |
(string-append "(" | |
(set-text (if (is-root? user) '(fg-red) '(fg-green)) | |
(string-append user "@" (or (get-host-name) ""))) | |
")-(" | |
(current-directory) | |
")-(" | |
(date->string (current-date) "~T") | |
")" | |
"\n$ ")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment