This file contains hidden or 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
(defun traffic-lights () | |
(let ((state 'red)) | |
(while t | |
(cond | |
((eq state 'red) | |
(message "Red") | |
(sleep-for 1) | |
(setq state 'red+yellow)) | |
((eq state 'red+yellow) | |
(message "Red+Yellow") |
This file contains hidden or 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
;; https://github.com/antirez/linenoise | |
;; console_codes(4) | |
(defvar column-start "\e[0G") | |
(defvar delete-to-end "\e[0K") | |
(defvar retreat-cursor "\e[%sD") | |
(defvar advance-cursor "\e[%sC") | |
(defvar clear-screen "\e[H\e[2J") | |
(defun read-byte () |
This file contains hidden or 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
(message (mapconcat 'char-to-string (list | |
(*(+(*)(*))(+(*)(*))(+(*)(*))(+(*)(*)(*))(+(*)(*)(*)))(+(+(*)(*)(*))(*(+(*)(*))(+(*(+(*)(*))(+(*)(*)))(+(*)(*)(*)))(+(*(+(*)(*))(+(*)(*)))(+;; | |
(* )(*) (*)))) )(*(+( *)(*))(+(* )(*))(+(*)(* )(*))(+(*) (*)(*) )(+(*)(* )(*)))(* (+(*)(*) )(+(*)(*)) (+(*)(*) (* | |
)) (+(* )(*)(* ))(+(*)(*) (*)))(+(+( *)(*)(*))( *(+( *)(*))(+ (* )( *))(+( *)(* )(*))( +(*) (*)(*) )(+(*)(*)( *))) )(*(+( *) | |
(* ))(+(* )(*))( +(*)(*))(+ (*)(*))(+( *)(* )))(*(+( *) (* )(*))( +(+( *)(*)) (*(+(*)( *)(*))(+(* )(*) (*))(+ (* | |
)( *)(* )))))( *(+(*)(*)( *))(+(*)(* (+(*)(*))( +(*) (*))(+(* )( *) (*))(+ (*)( *)(*)) )) )(*(+(*) (*))(+(*)( *)(* ))(+(+(*)( | |
*) (*)) (*(+(* )(*))( +(*)(* ))(+(*)( *))(+(*)(*)) )) )(*(+(*)(* ))(+(*)( *))( +(*)(* )(*))( +(*)(*)( *) | |
)(+(*)(*)(*)))(*(+(*)(*))(+(*)(*))(+(+(*)(*))(+(*)(*)(*)))(+(+(*)(*))(+(*)(*)(*))))(*(+(*)(*)(*))(+(+(*)(*))(*(+(*)(*)(*))(+ |
This file contains hidden or 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
(do | |
(js/require "process") | |
(.setEncoding js/process.stdin "utf8") | |
(.on js/process.stdin "data" | |
(fn [data] | |
(.write js/process.stdout data)))) |
This file contains hidden or 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
(dotimes (i 10) | |
(catch 'continue | |
(when (zerop (% i 2)) | |
(throw 'continue t)) | |
(message "%s" i))) | |
(let ((i 0)) | |
(catch 'break | |
(while t | |
(catch 'continue |
This file contains hidden or 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
(defun my-partition (n list) | |
(let (result) | |
(while list | |
(let ((i 0) | |
chunk) | |
(while (< i n) | |
(push (pop list) chunk) | |
(setq i (1+ i))) | |
(push (nreverse chunk) result))) | |
(nreverse result))) |
This file contains hidden or 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
(defun rotate-modeline () | |
(interactive) | |
(let ((original-mode-line-format mode-line-format) | |
(mode-line (format-mode-line mode-line-format)) | |
(interval 0.1)) | |
(unwind-protect | |
(while (not (input-pending-p)) | |
(setq mode-line (concat (substring mode-line 1) | |
(substring mode-line 0 1)) | |
mode-line-format mode-line) |
This file contains hidden or 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
(defface hl-tab-line | |
'((((type graphic)) :strike-through t) | |
(((type tty)) :underline t)) | |
"Tab line") | |
(defun hl-tab-fontify (beg end) | |
(let ((bol (save-excursion (goto-char beg) (line-beginning-position))) | |
(eol (save-excursion (goto-char end) (line-end-position)))) | |
(save-excursion | |
(goto-char bol) |
This file contains hidden or 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
;; taken from http://www.myrkraverk.com/blog/2014/11/the-convoluted-logic-of-rot13-in-ccl/ | |
(define-ccl-program my-ccl-rot13 | |
'(1 | |
((loop | |
(read r0) | |
;; The convoluted logic of rot13 in CCL. | |
(if (r0 >= 110) ; n | |
(if (r0 <= 122) ; z | |
((r0 -= 13))) ;; If we are between n-z | |
(if (r0 >= 97) ; a |
This file contains hidden or 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
;; Taken from PoCorGTFO 0x01 | |
;; Original: | |
;; function millis() {return Date.now();} | |
;; function flip_coin() {n=0; then = millis()+1; while(millis()<=then) {n=!n;} return n;} | |
;; function get_fair_bit() {while(1) {a=flip_coin(); if(a!=flip_coin()) {return(a);}}} | |
;; function get_random_byte() {n=0; bits=8; while(bits--){n<<1; n|=get_fair_bit();} return n;} | |
(defun prng--milliseconds () | |
(floor (* (float-time) 1000))) |