Skip to content

Instantly share code, notes, and snippets.

View kisp's full-sized avatar

Kilian Sprotte kisp

  • Berlin, Germany
  • 06:19 (UTC +02:00)
View GitHub Profile
@kisp
kisp / .Xresources
Last active July 5, 2016 19:59
.Xresources with solarized color scheme
! -*- mode:conf-xdefaults -*-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! solarized
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Solarized color scheme for the X Window System
!
! http://ethanschoonover.com/solarized
# ~/.gtkrc-2.0
gtk-theme-name="Clearlooks"
# ~/.config/gtk-3.0/settings.ini
[Settings]
gtk-theme-name=Adwaita
gtk-icon-theme-name=Adwaita
gtk-font-name=Cantarell 11
gtk-cursor-theme-name=Adwaita
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=1
@kisp
kisp / f.sql
Last active January 26, 2017 23:06
Change postgres default template0 to UTF8 encoding
-- psql -f f.sql
update pg_database set datallowconn = TRUE where datname = 'template0';
\c template0
update pg_database set datistemplate = FALSE where datname = 'template1';
drop database template1;
@kisp
kisp / install-emacs-snapshot.sh
Created January 27, 2017 11:39
Emacs snapshot install for cloud9 / c9 ubuntu.
sudo add-apt-repository -y ppa:ubuntu-elisp/ppa
sudo apt-get update
sudo apt-get install -y emacs-snapshot
sudo apt-get purge -y emacs24 emacs24-bin-common emacs24-common emacs24-common-non-dfsg
emacs --version
emacsclient --version
etags --version
@kisp
kisp / example.lisp
Created August 14, 2017 16:31
Disable terminal echoing in SBCL (e.g. for password prompts)
(defun prompt-for-password ()
(format t "Password: ")
(force-output)
(with-echoing-disabled
(prog1
(read-line)
(terpri))))
(format t "got ~S~%" (prompt-for-password))
@kisp
kisp / break.lisp
Last active May 26, 2024 10:27
SBCL break into debugger giving a REPL even if the debugger was previously disabled
(restart-case
(progn
(setq sb-ext:*invoke-debugger-hook* nil
cl:*debugger-hook* nil)
(break "~S" variable-of-interest)) ;or just (break)
(exit ()
:report (lambda (stream) (format stream "Exit with (sb-ext:exit)"))
(sb-ext:exit)))
@kisp
kisp / _README.org
Last active November 25, 2022 01:22
Setting real-time priority for a thread in sbcl
@kisp
kisp / run-unison.sh
Last active October 17, 2023 15:47
Setup unison sync with local configuration directory
#!/bin/bash
set -euxo pipefail
cd "$(dirname "$0")"
export UNISON=$(pwd)/.unison
mkdir -p "$UNISON"
@kisp
kisp / maybe.lisp
Last active November 28, 2023 13:02
Defining an algebraic data type in SBCL using defstruct, deftype, and trivia:match: data Maybe a = Nothing | Just a
(in-package :cl-user)
;; (ql:quickload '("alexandria" "trivia"))
;; Let's define maybe as an algebraic data type.
(defstruct (nothing (:constructor nothing ())))
(defstruct (just (:constructor just (value))) value)
(deftype maybe () '(or nothing just))
;; (>>=) :: Monad m => m a -> (a -> m b) -> m b