Skip to content

Instantly share code, notes, and snippets.

View TeMPOraL's full-sized avatar

Jacek Złydach TeMPOraL

View GitHub Profile
@TeMPOraL
TeMPOraL / regenerate.lisp
Created December 2, 2012 19:43
A static page generator
;;;; regenerate.lisp - script for regenerating [redacted] static HTML from template files.
(ql:quickload "cl-emb")
(ql:quickload "cl-fad")
(ql:quickload "cl-ppcre")
(defparameter *configuration* '() "plist containing config parameters passed to EMB templates.")
(defparameter *essays* '() "plist containing essay descriptors generated by `defessay'.")
(defconstant +default-properties+ '(:title nil :url nil :orig-title nil :orig-url nil :date nil :orig-date nil :alt-translations nil :translators nil :editors nil :disabled nil :additional-html nil :part-of-hnp nil :description ""))
@TeMPOraL
TeMPOraL / config.scm
Created November 4, 2017 20:20 — forked from mbakke/config.scm
GuixSD with custom kernel
(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 / bcm2835.lisp
Last active October 15, 2019 07:11 — forked from chomy/bcm2835.lisp
(defpackage :BCM2835
(:use :FFI)
(:export :init
:close
:gpio-fsel
:gpio-write
:gpio-lev
:gpio-set
:gpio-clr
:delay
@TeMPOraL
TeMPOraL / orgmode.el
Created November 3, 2016 13:58
Excerpts from the current config for org-mode I use.
(try-load-and-configure-library
'org-install
(setq org-hide-leading-stars t)
(setq org-pretty-entities t)
(setq org-pretty-entities-include-sub-superscripts nil)
(setq org-return-follows-link t)
(setq org-special-ctrl-a/e t)
(setq org-log-done t)
@TeMPOraL
TeMPOraL / stumpwmrc-part.lisp
Created October 24, 2018 05:34
.stumpwmrc - modeline with Dropbox and current org clock task
(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 / stream-to-emacs-buffer.lisp
Created April 6, 2018 09:51
Redirect a stream to Emacs buffer.
;;; 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 April 3, 2018 21:45
Serve files over HTTP directly from Emacs.
;;;; 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 / clx.lisp
Created September 11, 2017 18:30
Example of a X window that properly handles closing events from the WM.
(defpackage #:scratch/clx-test
(:use #:cl)
(:export #:run))
(in-package #:scratch/clx-test)
;;; A minimum test case for properly handling window close events from the window manager.
(defun delete-window-event-p (display type data)
(and (eq type :wm_protocols)
@TeMPOraL
TeMPOraL / emacs-directory-server.el
Last active May 29, 2018 04:01
Quickly serving files and directories via HTTP, with Emacs!
(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 05:41
Ad-hoc hydras for easier life
(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