Skip to content

Instantly share code, notes, and snippets.

View Fuco1's full-sized avatar
🕶️
Configuring Emacs

Matus Goljer Fuco1

🕶️
Configuring Emacs
View GitHub Profile
@Fuco1
Fuco1 / foo.v
Created January 6, 2016 20:20
Groups
Variable G : Set.
Variable e : G.
Variable inv : G -> G.
Variable mult : G -> G -> G.
Infix "*" := mult.
Axiom left_id : forall x : G, e * x = x.
Axiom left_inv : forall x : G, inv x * x = e.
Axiom assoc : forall x y z : G, x * (y * z) = (x * y) * z.
@Fuco1
Fuco1 / org-archive-subtree.el
Created October 30, 2016 13:12
Archive subtrees under the same hierarchy as original in the archive files.
(defadvice org-archive-subtree (around fix-hierarchy activate)
(let* ((fix-archive-p (and (not current-prefix-arg)
(not (use-region-p))))
(afile (org-extract-archive-file (org-get-local-archive-location)))
(buffer (or (find-buffer-visiting afile) (find-file-noselect afile))))
ad-do-it
(when fix-archive-p
(with-current-buffer buffer
(goto-char (point-max))
(while (org-up-heading-safe))
@Fuco1
Fuco1 / save-buffer-advice.el
Created March 3, 2017 20:51
Automatically save write-protected files with SUDO TRAMP method
;; TODO: package this?
(defadvice basic-save-buffer-2 (around fix-unwritable-save-with-sudo activate)
"When we save a buffer which is write-protected, try to sudo-save it.
When the buffer is write-protected it is usually opened in
read-only mode. Use \\[read-only-mode] to toggle
`read-only-mode', make your changes and \\[save-buffer] to save.
Emacs will warn you that the buffer is write-protected and asks
you to confirm if you really want to save. If you answer yes,
Emacs will use sudo tramp method to save the file and then
@Fuco1
Fuco1 / README.md
Last active November 9, 2017 12:04
org-graph

Relations

Relations are maintained through the outline hierarchy and special properties on the entries so we can model arbitrary graphs instead of only DAGs. This means you can define parents or children completely outside the hierarchy or even in different files.

Relations are kept in sync bidirectionally so please only use the API to maintain them otherwise things might get lost. Because the relations are bidirectional the graph traversal and querying is extremly fast.

Parents

Parents are defined by the GRAPH_PARENTS property as list of IDs and implicitly through the org outline hierarchy: all headlines above this one are this entry's parents.

$configurator->createRobotLoader()
->addDirectory($appDir)
->addDirectory(__DIR__ . '/Utils')
->register();
// zmenit na => (pridat .phpt scan)
$robotLoader = $configurator->createRobotLoader();
$robotLoader->acceptFiles = '*.php, *.phpt';
$robotLoader->addDirectory($appDir)

The columns mean: date, amount, cost per share, cost total, running sum of all shares, running cost of the position, the rest is in english :)

DatumPocetNakupCenaΣ PocetΣ CenaAvgEPSP/EDivYieldYOCIncome
[2016-01-27 Wed]995.00855.0009.000855.00095.0009.47010.0322.082.1892.18918.720
[2016-04-29 Fri]1193.001023.00020.0001878.00093.9008.9910.3452.282.4522.42845.600
[2016-09-16 Fri]-20116.00-2320.0000.000-442.000-inf8.9912.9032.281.966-0.0000.000
@Fuco1
Fuco1 / trinary.el
Created June 26, 2018 15:16
Trinary logic
(defconst trinary--true 1)
(defconst trinary--maybe 0)
(defconst trinary--false -1)
(defun trinary-print (value)
(let ((x (trinary-value-value value)))
(cond
((= x trinary--false) "F")
((= x trinary--maybe) "?")
((= x trinary--true) "T")))
@Fuco1
Fuco1 / smartparens-elsa-analysis-1
Created August 11, 2018 13:31
Elsa on Smartparens
[15:22:15]matus@herakleitos:~/.emacs.d/projects/smartparens
> time cask exec elsa smartparens.el
86:9:error:Argument 1 accepts type Symbol but received Mixed
93:18:error:Argument 2 accepts type Mixed but received Unbound
93:18:error:Argument 3 accepts type Mixed but received Unbound
93:18:error:Argument 4 accepts type Mixed but received Unbound
94:45:error:Argument 2 accepts type Mixed but received Unbound
131:37:error:Argument 1 accepts type Cons Mixed Mixed? but received Mixed
132:36:error:Argument 1 accepts type Mixed but received Unbound
@Fuco1
Fuco1 / test.md
Created September 1, 2018 11:56
python -c 'import os; os.execvp(\'emacs\', [\'emacs\', \'-batch\', \'-eval\', \'(progn (print "start") (princ "foo") (sit-for 5) (princ "\n"))\'])'

print method puts newline at the end automatically, princ does not. The above prints "start" then foo which I can't see only after 5 seconds when the newline is printed.

stdbuf -o0 python -c 'import os; os.execvp(\'emacs\', [\'emacs\', \'-batch\', \'-eval\', \'(progn (print "start") (princ "foo") (sit-for 5) (princ "\
n"))\'])'

Motions

  • forward
  • backward
  • next
  • previous
  • down
    • forward
    • backward
  • up