Skip to content

Instantly share code, notes, and snippets.

View shrdlu68's full-sized avatar

Brian Kamotho shrdlu68

View GitHub Profile
;;; Make multiple binding with a common prefix
(in-package :next)
(defmacro defhydra (name prefix &body suffixes)
`(progn
(defun ,name ()
(with-result (suffix (read-from-minibuffer
(mode *minibuffer*)))
(cond ,@(map 'list (lambda (arg)
(list (list 'equal 'suffix (first arg))
;;; Make multiple binding with a common prefix
(in-package :next)
(defmacro defhydra (name &body suffixes)
"Define a hydra named 'name'"
(let ((hydra-object (gensym))
(completion-function (gensym)))
`(progn
(defclass ,hydra-object ()
((key :accessor key :initarg :key)
(in-package :next)
(defhydra switch-buffer
("p" switch-buffer-previous)
("n" switch-buffer-next))
(define-key *global-map* (kbd "M-s") #'switch-buffer)
(defhydra load-url
("l" set-url-current-buffer)
(defpackage :my-first-app
;; Imports the appropriate CLIM library
(:use :clim :clim-lisp)
;; The package will only export a function to run the app
(:export run-my-first-app))
;; Good practice
(in-package :my-first-app)
;; Definition of the structure of a minimum app
(ql:quickload :cl-ppcre)
(defun decompress (in)
(multiple-value-bind (string matchp)
(cl-ppcre:regex-replace "([0-9]+)\\[([^][]*)\\]"
in
(lambda (match reg1 reg2)
@shrdlu68
shrdlu68 / audio-volume.sh
Created April 4, 2019 13:49
Control volume of active PulseAudio audio sink
#!/bin/bash
function get_active_sink ()
{
input=$(pactl list short sinks | awk '$7=="RUNNING" {print $2}')
echo -n "$input"
}
function mute_toggle ()
{