Skip to content

Instantly share code, notes, and snippets.

Avatar

Mikhail Skorzhinskii mskorzhinskiy

View GitHub Profile
@mskorzhinskiy
mskorzhinskiy / org-ids.el
Created Jul 13, 2021
My approach to make readable IDs in org-mode and make sensible directory names in org-attach folders
View org-ids.el
;; Taken from https://github.com/novoid/dot-emacs/blob/master/config.org
(defun my-generate-sanitized-alnum-dash-string (str)
"Returns a string which contains only a-zA-Z0-9 with single dashes
replacing all other characters in-between them.
Some parts were copied and adapted from org-hugo-slug
from https://github.com/kaushalmodi/ox-hugo (GPLv3)."
(let* (;; Remove "<FOO>..</FOO>" HTML tags if present.
(str (replace-regexp-in-string "<\\(?1:[a-z]+\\)[^>]*>.*</\\1>" "" str))
;; Remove org-mode links
@mskorzhinskiy
mskorzhinskiy / org-ql-rasmi.el
Created Dec 18, 2020
Current configuration for personal org queries
View org-ql-rasmi.el
(setq
org-ql-views
'(("stuck" lambda nil
(interactive)
(org-ql-search
(org-agenda-files)
'(and (tags "story")
(not (tags "ignore"))
(not (done)) ;; Finished stories should be excluded
(not (descendants (todo "NEXT"))) ;; If there are already
@mskorzhinskiy
mskorzhinskiy / ricing.el
Created Sep 1, 2020
Doom emacs org-mode ricing
View ricing.el
;; Font
(setq doom-font "Iosevka-9")
;; Hide signs like "~" or "_" or "*"
(setq org-hide-emphasis-markers t)
;; Don't align tags
(setq org-tags-column 0)
;; Increase indenation in org-indent
@mskorzhinskiy
mskorzhinskiy / emacs-org-attach-file.sh
Created Jun 28, 2020
Helper to attach files to org-mode
View emacs-org-attach-file.sh
#!/bin/bash
# Author: Mikhail Skorzhinskii <mskorzhinskiy@eml.cc>
#
# Description: Create a new file for org-mode and (may-be) try to attach it to
# the org-mode
choice=`kdialog --radiolist Type: Drawing Drawing on Screenshot Screenshot off Voice Voice off`
file_name=`uuidgen`
@mskorzhinskiy
mskorzhinskiy / org-new-navigation.el
Created Apr 22, 2020
Customized navigation for org-mode
View org-new-navigation.el
;; New navigation/edition
(defmacro org-user/save-state (&rest body)
"Helper for executing BODY with macroses."
(declare (debug (body)))
`(save-excursion
(save-restriction
(org-save-outline-visibility nil
,@body))))
@mskorzhinskiy
mskorzhinskiy / rofi-help.txt
Created Jan 30, 2017
Rofi configuration for bug report
View rofi-help.txt
rofi usage:
rofi [-options ...]
Command line only options:
-no-config Do not load configuration, use default values.
-v,-version Print the version number and exit.
-dmenu Start in dmenu mode.
-display [string] X server to contact.
${DISPLAY}
-h,-help This help message.
@mskorzhinskiy
mskorzhinskiy / vimrc.vim
Created Dec 4, 2016
My old vimrc file (used for Perl projects)
View vimrc.vim
""""""""""""""""""""""""""""""""""""""""""""""""
" File: .vimrc "
" Create Date: Nov 04, 2010 "
" Author: Michail Skorzinskiy "
" email : rasmikun@gmail.com "
" jabber: rasmikun@gmail.com "
""""""""""""""""""""""""""""""""""""""""""""""""
@mskorzhinskiy
mskorzhinskiy / scanf.c
Created Feb 25, 2016
Reading from input
View scanf.c
#define STRING_MAX_LENGTH 256
void read_some_input_snipper {
char *result;
char *name;
char buf[STRING_MAX_LENGTH];
fgets(buf, sizeof(buf), stdin);
ssprintf(buf, "%s%[^\n]", name, result);
}
@mskorzhinskiy
mskorzhinskiy / lang.el
Created Feb 24, 2016
Snippet for setting language
View lang.el
(defun set-russian-language ()
(interactive)
(set-input-method "russian-computer")
(ispell-change-dictionary "ru"))
(defun set-english-language ()
(interactive)
;; todo remove this ugly hack someday
(set-input-method "russian-computer")
View weird.el
;; Common use of third-party function looks like that:
(evilified-state-evilify-map
:mode some-emacs-mode
:bindings
(kdb "C-c a") 'function1
(kdb "C-c b") 'function2)
;; I want to declare function or macro that will produce such bindings