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
(defun kursplan-get-latest-revision-number (course-code &optional lang) | |
"Get the latest revision of kursplan in language LANG (\"se\" or \"en\") for COURSE-CODE." | |
(let* ((lang (or lang "sv")) | |
(url (format "https://edu.bth.se/utbildning/utb_kursplaner.asp?sok=%s" course-code)) | |
(pattern (format "kursplan\\?kurskod=%s&revision=\\([0-9]+\\)&lang=%s" course-code lang))) | |
(with-temp-buffer | |
(url-insert-file-contents url) | |
(goto-char (point-min)) | |
(re-search-forward pattern nil t nil) | |
(match-string 1)))) |
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
#!/usr/bin/env bash | |
CHUNKSIZE=5 | |
STARTDIR=. | |
EXTENSION=txt | |
TMPFILE="/tmp/chunk-tmp" | |
OUTFILE="./clony-out.txt" | |
FINDFLAGS="" |
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
# | |
# Javascript (jquery) Quiz-package for org-mode | |
# | |
# Copyright(c) Mikael Svahnberg, 2017. | |
# | |
# | |
# Load relevant libraries |
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
# | |
# Javascript (jquery) Tree-view macros for org-mode | |
# | |
# Copyright(c) Mikael Svahnberg, 2017. | |
# | |
# | |
# Load relevant libraries |
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
# Implementation of Brainfuck in Math.js | |
# Why? Because I can, and because I wanted to find out if Math.js was Turing complete | |
# | |
# Does not support nested iterations or input yet. Embryo for nested iterations is there though. | |
# 1=dp(start at 10), 2=out, 3="",4=ip, 5=lastip, 6=mute, 7=isp | |
d=zeros(100);d[1]=10;d[2]="";d[3]="";d[4]=1;d[5]=1;d[6]=0;d[7]=100; | |
mov(d,dir)=subset(d,index(1),d[1]+dir); | |
mod(d,m)=subset(d,index(d[1]),d[d[1]]+m); |
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
(defun msv-yank-with-lines (arg) | |
(interactive "P") | |
(let ((num 20)) | |
(when arg | |
(setq num arg)) | |
(insert "\n" (make-string num ?-) "\n") | |
(yank) | |
(insert "\n" (make-string num ?-) "\n") | |
)) |
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
(setq msv-cleanup-list '(dired-mode doc-view-mode image-mode magit-status-mode magit-log-edit-mode debugger-mode archive-mode)) | |
(defun msv-cleanup () | |
"Clean up and kill buffers that are no longer needed" | |
(interactive) | |
(save-excursion | |
(let ((count 0)) | |
(dolist (buffer (buffer-list)) | |
(set-buffer buffer) | |
(when (member major-mode msv-cleanup-list) |
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
;; Search mail from everywhere | |
;; (As long as you have started gnus already | |
(defun msv-search-mail () | |
(interactive) | |
(with-current-buffer "*Group*" | |
(save-excursion | |
(beginning-of-buffer) | |
(search-forward "All Mail") | |
(call-interactively (gnus-group-make-nnir-group nil))))) |
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
;; Add unread mailcount to modeline | |
;; I "cheat" by letting geektools run a script to do the real work once every 30secs, and then store it in a file. | |
;; (works better than letting emacs freeze to do the same thing) | |
;; ---------- | |
(setq msv-checkmail-timeout 10) | |
(setq msv-mailcount "") | |
(defun msv-check-mailcount () | |
(if (boundp 'msv-time-last) | |
(if (> (nth 1 (current-time)) (+ msv-time-last msv-checkmail-timeout)) |
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
;; -------------------- | |
;; Application Launcher | |
;; -------------------- | |
;; For OSX, where the "open" command knows most of what you would like to do. | |
(setq msv-launchers '(("conk" . (shell-command "open -a conkeror")) | |
("fox" . (shell-command "open -a firefox")) | |
("pfox" . (shell-command "open -a firefox --args -private")) | |
("finder" . (shell-command "open ~/Documents")) | |
("download" . (shell-command "open ~/Downloads")) |