Skip to content

Instantly share code, notes, and snippets.

Avatar

Jacek Złydach TeMPOraL

View GitHub Profile
@TeMPOraL
TeMPOraL / stumpwmrc-part.lisp
Created Oct 24, 2018
.stumpwmrc - modeline with Dropbox and current org clock task
View stumpwmrc-part.lisp
(defparameter *org-clock-current-task* "[N/A]")
(defparameter *dropbox-current-status* "[Dropbox current status here]")
;;; (...)
(defun current-dropbox ()
;; TODO colors
(first-line-only (run-external-program "dropbox" '("status"))))
;;; mode line
(setf *mode-line-timeout* 1)
@TeMPOraL
TeMPOraL / emacs-directory-server.el
Last active May 29, 2018
Quickly serving files and directories via HTTP, with Emacs!
View emacs-directory-server.el
(defvar my/file-server nil "Is the file server running? Holds an instance if so.")
(defalias 'my/send-directory-list 'ws-send-directory-list)
(defun my/ws-start (handlers port &optional log-buffer &rest network-args)
"Like `ws-start', but unbroken for Emacs 25+."
(let ((server (make-instance 'ws-server :handlers handlers :port port))
(log (when log-buffer (get-buffer-create log-buffer))))
(setf (process server)
(apply
@TeMPOraL
TeMPOraL / ad-hoc-hydras.el
Created May 11, 2018
Ad-hoc hydras for easier life
View ad-hoc-hydras.el
(defhydra hydra-host-os (:color teal :hint nil)
"
^Shell^ ^Other^
^^^^--------------------------------------
_e_: eshell _q_: quit
_E_: eshell here
_s_: shell command
_S_: shell command on region
_a_: async shell command
@TeMPOraL
TeMPOraL / stumpwm-multi-head.lisp
Created Apr 11, 2018
Some utilities for easier life with multiple heads in StumpWM.
View stumpwm-multi-head.lisp
(define-key *top-map* (kbd "s-f") "fselect") ; for faster access to select frame by number
;;; This is like fnext, but restricted to current head only.
(defun focus-next-frame-on-current-head (group)
"Focus next frame, limited to current head."
(let ((current-head (group-current-head group)))
(focus-frame-after group
(remove-if-not (lambda (frame)
(eql (frame-head group frame)
current-head))
@TeMPOraL
TeMPOraL / stream-to-emacs-buffer.lisp
Created Apr 6, 2018
Redirect a stream to Emacs buffer.
View stream-to-emacs-buffer.lisp
;;; Remember to set `slime-enable-evaluate-in-emacs' to t in Emacs.
;;; Also remember that it basically allows your Lisp to execute any code in your Emacs.
(defmacro with-output-to-emacs-buffer ((stream buffer-name) &body body)
`(let ((results (with-output-to-string (,stream)
,@body)))
(swank:eval-in-emacs `(with-current-buffer (get-buffer-create ,,buffer-name)
(erase-buffer)
(insert ,results)))))
;;; Use example:
@TeMPOraL
TeMPOraL / init-web-server.el
Created Apr 3, 2018
Serve files over HTTP directly from Emacs.
View init-web-server.el
;;;; A webserver in Emacs, because why not.
;;;; Basically a fast replacement for serve_this in Fish.
(use-package web-server
:config
(defvar my/file-server nil "Is the file server running? Holds an instance if so.")
(defun my/ws-start (handlers port &optional log-buffer &rest network-args)
@TeMPOraL
TeMPOraL / stumpwm-volume.lisp
Created Mar 16, 2018
StumpWM volume control for PulseAudio
View stumpwm-volume.lisp
;;; Volume control
(defun current-volume-settings ()
"Return current volume settings as multiple values (`MUTEDP', `VOLUME-LEFT-%', `VOLUME-RIGHT-%')."
(let* ((raw-output (run-shell-command "pactl list sinks" t))
(raw-mute (nth-value 1 (cl-ppcre:scan-to-strings "Mute: ([a-z]+)" raw-output)))
(raw-volume (nth-value 1 (cl-ppcre:scan-to-strings "Volume: .+/\\s+(\\d+).+/.+/\\s+(\\d+).+/" raw-output)))
(mutedp (string= (svref raw-mute 0) "yes"))
(vol%-l (parse-integer (svref raw-volume 0)))
(vol%-r (parse-integer (svref raw-volume 1))))
@TeMPOraL
TeMPOraL / low-level.lisp
Created Nov 12, 2017
cl-sdl-ttf2 hacking; I'm not going to install _yet another_ gcc instance on my Windows machine just because people _have_ to grovel stuff -.-
View low-level.lisp
(in-package :sdl2-ttf)
;;This file contains function definitions that could not be correctly wrapped by cl-autowrap (mainly due to no support for pass by value as of writing 6-22-2015)
(cffi:defcstruct (sdl-color)
(r :uint8)
(g :uint8)
(b :uint8)
(a :uint8))
@TeMPOraL
TeMPOraL / config.scm
Created Nov 4, 2017 — forked from mbakke/config.scm
GuixSD with custom kernel
View config.scm
(define-module (my packages)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages linux)
#:use-module (guix build-system trivial)
#:use-module (gnu)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix packages))
(define (linux-nonfree-urls version)
@TeMPOraL
TeMPOraL / emoji.ahk
Created Oct 4, 2017
Emoji Picker for Windows (via AutoHotkey)
View emoji.ahk
#F2::
WinGetClass, class, A
Gui, Emojiwin: New, +ToolWindow , Emoji Picker (%class%)
Gui, Font, s12, Segoe UI
Gui, Add, Text,, Pick an emoji:
Gui, Add, Button, gEFacepalm, &1. 🤦 Facepalm
Gui, Add, Button, gEPizza, &2. 🍕 Pizza
Gui, Add, Button, gEParty, &3. 🎉 Party
Gui, Show
Return