Skip to content

Instantly share code, notes, and snippets.

View sebasmonia's full-sized avatar

Sebastián Monía sebasmonia

View GitHub Profile
@sebasmonia
sebasmonia / toggle-backslash.el
Last active November 7, 2023 16:25 — forked from dov/toggle-backslash.el
Toggle between backslashes and forward slashes
(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
package main
import (
"encoding/json"
"fmt"
)
func main() {
b := []byte(`{"key":"value"}`)
(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")
@sebasmonia
sebasmonia / lsp-python.el
Created September 14, 2018 04:54
Initial setup for lsp-python
;; 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
@sebasmonia
sebasmonia / test.el
Created June 6, 2018 05:44
Emacs - reload PACKAGENAME from dev location to load-path folder
(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!"))
@sebasmonia
sebasmonia / package-handy-scripts.el
Last active December 26, 2018 08:22
Emacs packages - download and recompile
;; 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)
@sebasmonia
sebasmonia / dirwatcher.py
Created December 9, 2016 19:02
I don't know if this makes any sense
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))