123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 |
- (custom-set-variables
- ;; It is licensed under the GNU General Public License version 3 (or any later version).
- ;; You should have recieved a version of the GPL version 3 with this file (see COPYING.GPL),
- ;; if not see the FSF's website: https://www.gnu.org/licenses/gpl-3.0.en.html
- ;; custom-set-variables was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
- '(ansi-color-faces-vector
- [default default default italic underline success warning error])
- '(ansi-color-names-vector
- ["black" "#d55e00" "#009e73" "#f8ec59" "#0072b2" "#cc79a7" "#56b4e9" "white"])
- '(blink-cursor-mode nil)
- '(custom-enabled-themes '(whiteboard))
- '(custom-safe-themes
- '("1a094b79734450a146b0c43afb6c669045d7a8a5c28bc0210aba28d36f85d86f" "da8e6e5b286cbcec4a1a99f273a466de34763eefd0e84a41c71543b16cd2efac" "77515a438dc348e9d32310c070bfdddc5605efc83671a159b223e89044e4c4f1" "a455366c5cdacebd8adaa99d50e37430b0170326e7640a688e9d9ad406e2edfd" default))
- '(indent-line-function 'insert-tab t)
- '(indent-tabs-mode nil)
- '(iread-chars 20)
- '(iread-delay-milliseconds 400)
- '(iread-delay-seconds 0)
- '(iread-screenlength 100)
- '(ispell-dictionary nil)
- '(line-move-visual nil)
- '(max-lisp-eval-depth (expt 2 10))
- '(max-specpdl-size 34294)
- '(package-selected-packages
- '(tabbar session pod-mode muttrc-mode mutt-alias markdown-mode initsplit htmlize graphviz-dot-mode folding ess eproject elpher diminish csv-mode company color-theme-modern cmake-mode browse-kill-ring boxquote bm bar-cursor apache-mode))
- '(python-shell-interpreter "python3")
- '(send-mail-function 'sendmail-send-it)
- '(shell-command-default-error-buffer 'stderror-buffer t)
- '(tab-width 5)
- '(tool-bar-mode nil)
- '(undo-outer-limit (expt 2 24))
- '(visible-bell t)
- )
- (electric-indent-mode 0)
- ;; I basically never want to hit this key
- (global-set-key (kbd "<insert>") 'nil)
- (custom-set-faces
- ;; custom-set-faces was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
- )
- (if (display-graphic-p)
- (setq initial-frame-alist
- '(
- (tool-bar-lines . 0)
- (width . 106)
- (height . 60)
- (background-color . "black")
- (foreground-color . "orange")
- (left . 50)
- (top . 50)))
- (setq initial-frame-alist '( (tool-bar-lines . 0))))
- (setq default-frame-alist initial-frame-alist)
- (put 'scroll-left 'disabled nil)
- (defun twitterablep () "is region twitterable? #elisp" (interactive) (message (if (> 140 (abs (- (point) (mark)))) "yes" "no")))
- (defun nullp (l)
- "is this null?"
- (equal '() l))
- (defun reduce (p l)
- "reduce function?"
- (if
- (nullp l)
- l
- (if (listp l)
- (if (= (length l) 1)
- l
- (if (= (length l) 2)
- (funcall p (car l) (car (cdr l)))
- (reduce p
- (cons
- (funcall p (car l)
- (car (cdr l)))
- (cdr
- (cdr l))))))
- l)
- ))
- (defun map (f l)
- "map function?"
- (if
- (nullp l)
- '()
- (if (listp l)
- (if (= 1 (length l))
- (list (funcall f (car l)))
- (if (> (length l) 1)
- (cons (map f (car l))
- (map f (cdr l)))))
- (funcall f l)
- )))
- (require 'dired-x)
- ; broken? (require ’ess-r-mode)
- ; (setq web-browser "/home/themusicgod1/palemooon/Pale-Moon-27.3.0_Release/obj-x86_64-unknown-linux-gnu/dist/bin/palemoon");
- (setq web-browser "/home/themusicgod1/tor-browser/tor-browser_en-US/Browser/runtorbrowser.sh")
- ; (setq web-browser "chromium-browser")
- (fset 'traverse-hyperlink-line
- (format "(shell-command \"%s '\C-e' & sleep 0.6; \")\C-x\C-e\C-f\C-p\C-k\C-d" web-browser))
- (fset 'unsqlize-delete
- "\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-d\C-s\"\C-b\C-k\C-f")
- (fset 'url-macro-1 "\C-d\C-d\C-d\C-n\C-d")
- (fset 'run-delete-sqls-in-ansi-term
- [C-S-down S-up (menu-bar) edit copy ?\C-x ?\C-f return ?\C-s ?T ?D ?L ?\C-m return ?\M-x ?a ?n ?s ?i ?- ?t ?e ?r ?m return return ?s ?q ?l ?i ?t ?e ?3 ? ?u ?r ?l ?s ?. ?d ?b return S-insert ?e ?x ?i ?t return ?\; return ?. ?e ?x ?i ?t return ?e ?x ?i ?t return ?\C-x ?k return ?\C-x ?k return ?\C-x ?k return C-up C-down])
- (fset 'twitter-macro-1
- [?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?f backspace ?\C-f ?a ?g ?a ?i ?n ? ?\C-e ?\C-f])
- (fset 'tweet
- [?\C-k ?\M-x ?u backspace ?u backspace ?b ?u ?f ?f ?e ?r ?- ?m ?e ?n ?u return ?\C-s ?t ?w ?i ?t ?t ?e ?r ?\C-m return S-insert return ?\C-x left ?\M-x ?b ?u ?f ?f ?e ?r ?- ?m ?e ?n ?u return ?\C-n return ?\C-d])
- (defun dec2hex (dec) "decimal to hex" (interactive dec2hex) (message "%x" dec))
- (defun hex2dec (hex) "hex to decimal" (interactive hex2dec) (message "%d" hex))
- (defun hex2dec1 (hex) "hex to decimal" (interactive hex2dec) (message "%d" (message "#x%x" hex)))
- ;; https://github.com/bard/mozrepl/wiki/Emacs-integration
- (add-to-list 'load-path "/home/themusicgod1/emacs")
- (autoload 'moz-minor-mode "moz" "Mozilla Minor and Inferior Mozilla Modes" t)
- (add-hook 'javascript-mode-hook 'javascript-custom-setup)
- (defun javascript-custom-setup ()
- (moz-minor-mode 1))
- ;; https://github.com/RenWenshan/emacs-moz-controller
- (add-to-list 'load-path "/home/themusicgod1/emacs/emacs-moz-controller")
- (require 'moz-controller)
- (fset 'firefox-macro-1
- "\C-cml\C-y")
- (fset 'moz-macro-2
- [?\M-x ?w ?i ?n ?d ?m ?o ?v ?e ?- ?u ?p return C-end return ?g ?B ?r ?o ?w ?s ?e ?r ?. ?g ?e ?t ?B ?r ?o ?w ?s ?e ?r ?F ?o ?r ?T ?a ?b ?\( ?g ?B ?r ?o ?w ?s ?e ?r ?. ?s ?e ?l ?e ?c ?t ?e ?d ?T ?a ?b ?\) ?. ?c ?u ?r ?r ?e ?n ?t ?U ?R ?I ?. ?s ?p ?e ?c return ?\M-x ?w ?i ?n ?d ?m ?o ?v ?e ?- ?d ?o ?w ?n return])
- (fset 'moz-macro-3
- [?\M-x ?w ?i ?n ?d ?m ?o ?v ?e ?- ?u ?p return ?\C-p home ?\C-k ?\M-x ?w ?i ?n ?d ?m ?o ?v ?e ?- ?d ?o ?w ?n return ?\C-y return ?\C-p ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-d ?\C-s ?\' backspace ?\" ?\C-b ?\C-d ?\C-f])
- (fset 'moz-close-tab
- [?\M-x ?w ?i ?n ?d ?m ?o ?v ?e ?- ?u ?p return ?g ?B ?r ?o ?w ?s ?e ?r ?. ?r ?e ?m ?o ?v ?e ?C ?r ?u ?r ?e ?n backspace backspace backspace backspace backspace ?u ?r ?r ?e ?n ?t ?T ?a ?b ?\( ?\) ?\; return ?\M-x ?w ?i ?n ?d ?m ?o ?v ?e ?- ?d ?o ?w ?n return])
- (global-set-key '[(f1)] 'traverse-hyperlink-line)
- (global-set-key '[(f2)] 'unsqlize-delete)
- (global-set-key '[(f3)] 'twitter-macro-1)
- (global-set-key '[(f4)] 'url-macro-1)
- (global-set-key '[(f5)] 'firefox-macro-2)
- (global-set-key '[(f6)] 'firefox-macro-3)
- (global-set-key '[(f7)] 'moz-close-tab)
- (defun sum (L) (reduce '+ L))
- (defun sizeof (L) (length L))
- (defun getElement (N L)
- "returns the Nth element of list L. 0 indexed"
- (if (<= N 0)
- (car L)
- (getElement (- N 1 ) (cdr L) )
- )
- )
- (defun listOfNfs (N f)
- "returns a list of N fs"
- (if (<= N 0)
- '()
- (cons f (listOfNfs (- N 1) f))))
- (defun sign (N)
- (if (numberp N)
- (if (> N 0) 1
- (if (< N 0) -1
- 0)) NaN
- ))
- (defun log2 (N) (/ (log N) (log 2)))
- (defun entropy (P1) (- (+ (* P1 (log2 P1)))))
- (defun zero? (Z)
- (if (numberp Z )
- (if (= Z 0)
- 1
- nil)
- nil))
- (defun eqv? (A B)
- (if (and (numberp A ) (numberp B) )
- (if (= A B)
- 1
- nil)
- nil))
- (defun binome
- (n k)
- (if (> k n) '(help, I'm trapped in a universe factory!)
- (if (zero? k) 1
- (if (eqv? k n) 1
- (+ (funcall 'binome (- n 1) k) (funcall 'binome (- n 1) (- k 1)) )
- )
- ))
- )
- (defun avg (L) (/ (sum L) (length L)))
- (defun positiveintegerp (n)
- "0+ is positive here"
- (if (integerp n)
- (if (>= n 0)
- 1
- nil)
- nil
- )
- )
- (defun ! (N)
- (if (positiveintegerp N)
- (if (= N 0)
- 1
- (if (> N 0)
- (* N (! (- N 1))) N))
- "error: incorrect data, positive integer required"))
- (defun do-n-times (f n x)
- "call function f with arity 1 on data x on itself n times, f1(f2(f...(fn(x)))). n must be positive nonzero integer"
- (if (> n 0)
- (funcall f (do-n-times f (- n 1) x))
- x)
- )
- (defun mf (m) (/ (- (expt 2.0 m) 1) (expt 2.0 m)))
- (defun nsp (P1 P2)
- (setq diff (abs (- P1 P2)))
- ;; ordinal
- (setq fair (string-to-int (format "%d" (/ 1.0 (entropy diff)))))
- ;;(message "entropy diff %d" (/ 1.0 (entropy diff)))
- ;;(message "fair %d" fair)
- ;; we want this in flips of a number
- (mf fair)
- )
- (defun whatprob (p) (/ (+ (- 2) (sqrt (- 4 (* 4 p ) ))) (* -2)))
- (defun whatprob2 (p) (- (* 2 p) (* p p)))
- (defun drop-1 (L) (reverse (cdr (reverse L))))
- (defun drop (L n)
- (setq err "drop requires a positive integer argument n (drop <list> N)")
- (if (= n 0)
- L
- (if (< n 1)
- (message "%s" err)
- (if (not (listp L))
- (message "%s" err)
- (do-n-times 'drop-1 n L)))))
- (defun successor (n)
- "successor function"
- (+ n 1))
- (defun 名单 ( &rest ns) ns)
- (defun *L (L1 L2 f)
- "takes function/binary relation f and applies it like dot product to lists L1 & L2's members"
- (*L-helper L1 L2 f (sizeof L1) ))
- (defun *L-helper (L1 L2 f N)
- (if (not (= N 0))
- (cons (funcall f (car L1) (car L2)) (*L-helper (cdr L1) (cdr L2) f (- N 1)))))
- (defun nCr (a b)
- "a choose b : a > b, (a,b) e Z+. The problem with doing it this way is a,b can get too big. at ~19 we start seeing overflows. if we ever need this, rewrite to reduce factors"
- (if (and (positiveintegerp a) (positiveintegerp b))
- (if (and (>= a b) (>= a 0) (>= b 0) (< a 19) (< b 19))
- (/ (! a) (* (! (- a b) ) (! b)))
- "error: nCr range error")
- "error: nCr requires positive integers"))
- (setq max_int (- (expt 2 61) 1))
- (setq e (exp 1))
- (setq pi (* 4 (atan 1)))
- (fset 'justify-hard-to-read-block
- [escape ?7 ?9 right C-right return C-left return end delete ? home])
- (defun ^ (a b)
- (expt a b))
- (defun stddev (L)
- "finds standard deviation of list L"
- (sqrt (/ (std-helper L (avg L)) (- (sizeof L) 1))))
- (defun std-helper (L a)
- "recursively goes through L, adding partial standard deviation sum as it goes"
- (if (nullp L)
- 0
- (+ (^ (- (car L) a) 2) (std-helper (cdr L) a))))
- (defun stderr (L)
- "standard error"
- (/ (stddev L) (sqrt (sizeof L)) ))
- (defun dot (L1 L2)
- ; "dot product" of L1 and L2
- (if (and (= (sizeof L1) 0)
- (= (sizeof L1) 0))
- '()
- (if (= (sizeof L1) (sizeof L2))
- (cons (* (car L2) (car L1))
- (dot (cdr L1) (cdr L2)))
- "lists not equal size")))
- (defun sumfrom1ton (N) (message "%x" (/ (* N (+ N 1)) 2)))
- ;; i don't remember how to use this one
- (defun debias (bias belief)
- (+ 50 (* (sign (- belief 50)) (sqrt (* (- 1 bias ) (expt (- belief 50) 2))))))
- (when window-system
- (set-fringe-style 1)
- (set-cursor-color "white"))
|