A real quick GNU screen crash course with the key features I use.
man screen
- Emulates terminals in a full-screen window manager
- Detachable, so shell sessions aren't attached to a login process
| ; Turn a map into a JTree | |
| ; keys can be any object using toString to display | |
| ; listener is called as (listener seq-of-keys-to-selected-node) | |
| ;root | |
| ; |-child-1 | |
| ; | |-Child-1-1 | |
| ; | |-child-1-2 | |
| ; |-child-2 | |
| ; |-child-3 |
| # turn a jar with a Main-Class into a stand alone executable | |
| (echo '#!/usr/bin/env java -jar'; cat blahblah.jar) > blah | |
| # turn a jar with a particular main clas into a stand alone executable | |
| (echo '#!/usr/bin/env java -jar package.MainClass'; cat blahblah.jar) > blah |
| ~/$ lein new ring-on-heroku | |
| Created new project in: /home/jim/Development/ring-on-heroku | |
| ~/$ cd ring-on-heroku | |
| ~/ring-on-heroku$ echo 'web: lein run -m ring-on-heroku.core' > Procfile | |
| ~/ring-on-heroku$ cat > src/ring_on_heroku/core.clj | |
| (ns ring-on-heroku.core | |
| (:use ring.util.response | |
| ring.adapter.jetty)) | |
| (defn app [req] |
| (ns reify-generic | |
| "reify a protocol such that every method is delegated to a specified method") | |
| (defmacro reify-generic | |
| "Reify the given protocols. Every method of any protocol is implemented such | |
| that f is called as (apply f protocol-method args) | |
| Example: | |
| (defprotocol Calculator |
| (ns state-is-a-fold | |
| (:use clojure.test)) | |
| ;;; After all, state is a fold of events. For example let's say the events are a sequence of numbers | |
| ;;; and we are folding by addition: | |
| (deftest simple | |
| (let [events [1 5 2 4 3] | |
| state (reduce + events)] | |
| (is (= 15 state)))) |
| (defn get-clipboard [] | |
| (.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit))) | |
| (defn slurp-clipboard [] | |
| (try | |
| (.getTransferData (.getContents (get-clipboard) nil) (java.awt.datatransfer.DataFlavor/stringFlavor)) | |
| (catch java.lang.NullPointerException e nil))) | |
| (defn spit-clipboard [text] | |
| (.setContents (get-clipboard) (java.awt.datatransfer.StringSelection. text) nil)) |
| ;; chouser's solution to Read Roman numerals | |
| ;; https://4clojure.com/problem/92 | |
| (fn [r] | |
| (->> | |
| (reverse r) | |
| (map {\M 1000 \D 500 \C 100 \L 50 \X 10 \V 5 \I 1}) | |
| (cons 0) | |
| (partition 2 1) | |
| (reduce |
| (ns tarai.core | |
| (:use [overtone.live])) | |
| ;; basic.clj より | |
| (defsynth foo [freq 200 dur 0.5] | |
| (let [src (saw [freq (* freq 1.01) (* 0.99 freq)]) | |
| low (sin-osc (/ freq 2)) | |
| filt (lpf src (line:kr (* 10 freq) freq 10)) | |
| env (env-gen (perc 0.1 dur) :action FREE)] | |
| (out 0 (pan2 (* 0.1 low env filt))))) |