Skip to content

Instantly share code, notes, and snippets.

View shegeley's full-sized avatar
🍴
Fork you

Grigory Shepelev shegeley

🍴
Fork you
View GitHub Profile
@shegeley
shegeley / dashboard-hacks.el
Last active June 1, 2025 05:03
Prevent loading remote projects in emacs-dashboard to speed up dashboard's startup.
;;; dashboard-hacks.el --- Emacs Dashboard Hacks -*- lexical-binding: t; -*-
(require 'project)
(defun project-forget-remote-projects ()
"Forget all remote projects. emacs-dashboard lags massively when trying to display remote projects via project.el"
(interactive)
(dolist (proj (project-known-project-roots))
(when (file-remote-p proj)
(project-forget-project proj))))
@shegeley
shegeley / bitcoin.scm
Last active April 27, 2025 04:22
bitcon services type sample packed in guix
(use-modules
(gnu services)
(gnu services shepherd)
(gnu packages finance)
(srfi srfi-1)
(srfi srfi-125)
(ice-9 match)
(guix gexp)
@shegeley
shegeley / java&type-script.scm
Last active March 2, 2025 16:34
Guix custom java&type-script feature using Deno
;; emacs-flycheck-deno is on-hold in guix https://patches.guix-patches.cbaines.net/project/guix-patches/patch/[email protected]/
;; emacs-deno-mode: https://github.com/shegeley/x-files/commit/2e941ccb3ebd280767d4b0410eb0cce0ecc68bd8
;; deno: https://github.com/shegeley/x-files/commit/eaf140b29127c849ef529ed4cac5dad68f94c166
(define-module (g-files features java&type-script)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (x-files packages deno)
@shegeley
shegeley / daemons-fix.el
Last active February 17, 2025 19:25
Guix System Emacs daemons.el colorized output parsing fix
(with-eval-after-load 'daemons
(require 'ansi-color)
(defun display-ansi-sequences ()
(let ((inhibit-read-only t))
(ansi-color-apply-on-region (point-min) (point-max))))
(setq daemons--shell-command-to-string-fun
(lambda (command) (ansi-color-filter-apply (shell-command-to-string command))))
(add-hook 'daemons-output-mode-hook 'display-ansi-sequences))
@shegeley
shegeley / backend.cljs
Created December 5, 2024 18:23
clojurescript: sequelize, expresss, cljs.core.async sample code
(ns backend.core
(:require ["sequelize" :refer (Sequelize DataTypes)]
[cljs.core.async :refer [go]]
[cljs.core.async.interop :refer-macros [<p!]]
["express" :as express]))
(def port 1337)
(defn env [x & [default]]
(or (aget (.. js/process -env) x) default))
@shegeley
shegeley / treemacs-auto-toggle.el
Created October 28, 2024 08:05
Emacs Treemacs auto-toggling in text and prog-modes. Author: @ichernyshovvv
(defun treemacs-toggle-maybe ()
(require 'treemacs)
(if (eq last-command 'treemacs)
(set-frame-parameter (selected-frame) 'treemacs-forced-p
(not (frame-parameter (selected-frame) 'treemacs-forced-p)))
(unless (frame-parameter (selected-frame) 'treemacs-forced-p)
(if (seq-find
(lambda (x)
(with-current-buffer (window-buffer x)
(derived-mode-p 'text-mode 'prog-mode)))
@shegeley
shegeley / srfi-125.scm
Last active May 26, 2024 05:57
Guile Scheme SRFI-125 packaging attempt
(use-modules
(guix gexp)
(guix download)
((guix licenses) #:prefix license:)
(guix packages)
(guix git-download)
(guix download)
(guix utils)
(guix build-system guile)
(gnu packages guile)
@shegeley
shegeley / hash-table-compare.scm
Last active May 21, 2024 17:44
Guile Scheme hash table deep hash and equality comparsion
(use-modules (srfi srfi-69))
#|
(hash (list 1 2)) => 1690321764596975924
(hash (list 2 1)) => 1690321764596975924
(hash (vector 1 2)) => 2121270931541232526
(hash (vector 2 1)) => 1271456826911243416
|#
(define (hash-table-deep-hash table)
@shegeley
shegeley / scmfmt.scm
Created June 14, 2023 07:20 — forked from ojarjur/scmfmt.scm
Code formatter for Scheme using Guile's pretty-print method. This reads from stdin and writes to stdout.
(use-modules (ice-9 pretty-print))
;; Helper methods for maintaining comments and whitespace.
(define (copy-line-comment)
(let ((char (read-char)))
(if (not (eof-object? char))
(if (eq? char #\newline)
(newline)
(begin (write-char char) (copy-line-comment))))))
(define (maintain-empty-lines)
@shegeley
shegeley / convenience-lambda.scm
Created April 15, 2023 03:30 — forked from shanecelis/convenience-lambda.scm
A succinct anonymous procedure syntax for Guile scheme
;; convenience-lambda.scm
;;
;; This syntax was inspired by arc and Clojure's anonymous procedure
;; syntax.
;;
;; #.\ (+ %1 %2) -> (lambda (%1 %2) (+ %1 %2))
;; #.\ (+ % %%) -> (lambda (% %%) (+ % %%))
;;
;; The .\ is supposed to approximate the lowercase lambda character in
;; ascii.