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 toggle-backslash-dwim (&optional start end) | |
"Toggle slashes-backslashes for the active region. | |
If there's no active region START and END, it operates on the | |
current line." | |
(interactive "r") | |
(save-excursion | |
(unless (use-region-p) | |
(cl-destructuring-bind (a . b) | |
(bounds-of-thing-at-point 'line) | |
(setf start a |
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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
func main() { | |
b := []byte(`{"key":"value"}`) |
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 hoagie-kmonad-start () | |
(interactive) | |
(start-process "kmonad-process" | |
"*kmonad*" | |
"kmonad" | |
"c:\\home\\.config\\kmonad\\config.kbd") | |
(message "kmonad started (•_•) ( •_•)>⌐■-■ (⌐■_■)")) | |
(defun hoagie-kmonad-stop () | |
(interactive) | |
(kill-process "kmonad-process") |
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
;; LSP MODE | |
;; from https://vxlabs.com/2018/06/08/python-language-server-with-emacs-and-lsp-mode/ | |
(require 'lsp-mode) | |
(require 'lsp-ui) | |
(require 'lsp-imenu) | |
(add-hook 'lsp-after-open-hook 'lsp-enable-imenu) | |
(setq lsp-ui-sideline-ignore-duplicate t) | |
(add-hook 'lsp-mode-hook 'lsp-ui-mode) | |
(lsp-define-stdio-client lsp-python "python" | |
#'projectile-project-root |
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 reload-PACKAGENAME () | |
(interactive) | |
(message "Unloading...") | |
(ignore-errors | |
(unload-feature 'PACKAGENAME t)) | |
(message "Copying...") | |
(copy-file "path/to/git/version/PACKAGENAME.el" "~/.emacs.d/lisp/PACKAGENAME.el" t) | |
(require 'PACKAGENAME) | |
(message "Reloaded!")) |
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
;; Install the packages in the config. Use when moved to new computer after updating init.el/.emacs | |
(package-initialize) | |
(unless package-archive-contents | |
(package-refresh-contents)) | |
(package-install-selected-packages) | |
;; Recompile all packages after major version change | |
;; In scratch or M-: run the following | |
(byte-recompile-directory package-user-dir nil 'force) |
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
import os | |
import asyncio | |
async def watch (dir_to_watch, callbacks, interval=2, fire_for_existing_files=True): | |
counter = 0 | |
current_contents = None | |
callbacks = callbacks | |
if not fire_for_existing_files: | |
before = set(os.listdir(dir_to_watch)) |