Skip to content

Instantly share code, notes, and snippets.

View AloisJanicek's full-sized avatar

Alois Janíček AloisJanicek

View GitHub Profile
@AloisJanicek
AloisJanicek / init.el
Last active February 9, 2022 16:07
Minimal emacs init.el for fun or profit. With evil and counsel but without use-package or straight. Ready for both terminal and GUI.
;; Setup packages and stuff
(require 'package)
;; Add MELPA
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(unless package--initialized
(package-initialize))
@AloisJanicek
AloisJanicek / org-protocol-to-wsl-emacs.reg
Created November 29, 2020 22:44
Org-protocol setup with emacs inside WSL
REGEDIT4
[HKEY_CLASSES_ROOT\org-protocol]
@="URL:Org Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\org-protocol\shell]
[HKEY_CLASSES_ROOT\org-protocol\shell\open]
[HKEY_CLASSES_ROOT\org-protocol\shell\open\command]
@="\"C:\\BIN\\org-protocol-to-wsl-helper.bat\" \"%1\""
@AloisJanicek
AloisJanicek / kwin_grayscale_toggle.sh
Last active February 10, 2022 15:35
Toggle Grayscale Effect in Plasma Desktop KWin with adjusted gamma (X11)
#!/bin/bash
# PREREQUISITES
# - KWin Grayscale Effect
# https://store.kde.org/p/1263836/
# install it via System Settings -> Workspace Behavior -> Desktop Effects [Get New Desktop Effects...] and search for "Grayscale Effect"
# OR ALTERNATIVELY
# install it from command line:
# /usr/lib/kf5/kpackagehandlers/knshandler kns://plasmoids.knsrc/api.kde-look.org/1263836
#
@AloisJanicek
AloisJanicek / org-protocols.js
Last active December 14, 2023 20:12
all-in-one org-protocols user script for Chrome based browsers
// ==UserScript==
// @name org-protocols
// @namespace http://tampermonkey.net/
// @version 0.2.0
// @description Send links or/and selected content into your Emacs via various protocols
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
@AloisJanicek
AloisJanicek / html-beautify-auto.el
Created May 16, 2018 13:36
Run `html-beautify on html file opened in Emacs buffer when saving it
(defun beautify-html-file-and-revert ()
"Beautify file with html-beautify and only if major mode is web-mode"
(interactive)
(when (eq major-mode 'web-mode)
(message "html-beautify taking care of your markup" (buffer-file-name))
(shell-command (concat "html-beautify --quiet --replace -s 2 -I -E \"\" --max-preserve-newlines 0 -f " (buffer-file-name)))
(revert-buffer t t)))
(add-hook 'after-save-hook #'beautify-html-file-and-revert)
@AloisJanicek
AloisJanicek / prettier-stylelint-auto.el
Last active February 10, 2022 15:35 — forked from ustun/eslint-auto.el
Run `prettier-stylelint --write` on css file opened in Emacs buffer when saving it
;;; runs `prettier-stylelint --write` on the current file after save
;;; alpha quality -- use at your own risk
(defun prettier-stylelint-fix-file-and-revert ()
"Prettify current file and apply fixes only in css-mode or scss-mode"
(interactive)
(when (or (eq major-mode 'css-mode) (eq major-mode 'scss-mode))
(message "prettier-stylelint fixing your file" (buffer-file-name)) ;;optional line, you can remove it
(shell-command (concat "prettier-stylelint --quiet --write " (buffer-file-name)))
(revert-buffer t t)))
@AloisJanicek
AloisJanicek / toggle_urxvt.sh
Created September 30, 2014 04:50
Toggle urxvt
#!/bin/sh
wid=$(xdotool search --classname urxvt)
if [ -z $wid ]
then
urxvt -e sh -c "tmux"
wid=$(xdotool search --classname urxvt)
xdotool windowfocus $wid
elif [ -z $(xdotool search --onlyvisible --classname urxvt 2>/dev/null) ]