Skip to content

Instantly share code, notes, and snippets.

View jollm's full-sized avatar

Jo Gay jollm

  • Seattle, WA
View GitHub Profile
(defpackage #:iolib-test-case
(:use #:cl)
(:use #:iolib))
(in-package :iolib-test-case)
;; The special variable used to hold the client socket for the thread
;; managing it.
(defvar *ex5-tls-client* nil)
(loop
(with-open-bus (bus (session-server-addresses))
(with-introspected-object (notify bus "/org/freedesktop/Notifications" "org.freedesktop.Notifications")
(notify "org.freedesktop.DBus.Introspectable" "Introspect")
(notify "org.freedesktop.Notifications" "GetCapabilities")
(notify "org.freedesktop.Notifications" "GetServerInformation"))
(format t "."))
(iolib.syscalls:usleep 500000))
;; this hung after about 10 minutes, code executing should reflect what's in death/dbus
@jollm
jollm / gist:1758803
Created February 7, 2012 09:46
from iolib, would expect to see harvest events in stacktrace, but instead see dispatch-fd-events-once
(defun dispatch-fd-events-once (event-base timeout now)
(loop
:with fd-events := (harvest-events (mux-of event-base) timeout)
:for ev :in fd-events
:for dlist := (%handle-one-fd event-base ev now nil)
:then (%handle-one-fd event-base ev now dlist)
:finally
(priority-queue-reorder (fd-timers-of event-base))
(return (values (consp fd-events) dlist))))
Backtrace:
0: ("bogus stack frame")
[No Locals]
1: (IOLIB.MULTIPLEX::DISPATCH-FD-EVENTS-ONCE #<event base, 0 FDs monitored, using: #<epoll(4) multiplexer> {1007A82C43}> 199.99558672700368d0 75996.813276374d0)
Locals:
SB-DEBUG::ARG-0 = #<event base, 0 FDs monitored, using: #<epoll(4) multiplexer> {1007A82C43}>
SB-DEBUG::ARG-1 = 199.99558672700368d0
SB-DEBUG::ARG-2 = 75996.813276374d0
2: ((SB-PCL::FAST-METHOD IOLIB.MULTIPLEX:EVENT-DISPATCH (IOLIB.MULTIPLEX:EVENT-BASE)) ..)
Locals:
;; wicd helper commands for StumpWM.
;;
;; Copyright (C) 2012 Joseph Gay
;;
;; Maintainer: Joseph Gay
;;
;; This module is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
@jollm
jollm / wicd.lisp
Created January 13, 2012 16:50
commands to operate wicd
(defcommand wicd-x () ()
"disconnect wicd"
(run-shell-command "wicd-cli -x"))
(defcommand wicd-c () (:rest)
"Allow the user to select a network from a list"
(let ((network (second (select-from-menu
(current-screen)
(append '(("wired" "wired"))
(mapcar (lambda (v) (list (elt v 1) (elt v 0)))
(defspec
rect
"Rectangular region"
[format
:nbits (5 bits)
(let [coord (:nbits bits)]
(for [k [:xmin :xmax :ymin :ymax]]
[k coord]))]
[rules
:nbits unsigned
(defvar message-filter-regexp-list '("^Starting new Ispell process \\[.+\\] \\.\\.\\.$"
"^Ispell process killed$")
"filter formatted message string to remove noisy messages")
(defadvice message (around message-filter-by-regexp activate)
(if (not (ad-get-arg 0))
ad-do-it
(let ((formatted-string (apply 'format (ad-get-args 0))))
(if (and (stringp formatted-string)
(some (lambda (re) (string-match re formatted-string)) message-filter-regexp-list))
(save-excursion
(defun ido-bury-buffer-at-head ()
"Bury the buffer at the head of `ido-matches'.
If cursor is not at the end of the user input, delete to end of input."
(interactive)
(if (not (eobp))
(delete-region (point) (line-end-position))
(let ((enable-recursive-minibuffers t)
(buf (ido-name (car ido-matches))))
(when buf
(bury-buffer buf)
;; set up dual head if VGA1 is connected
(defcommand xrandr-on-vga1 () ()
(let* ((xrandr-output (run-shell-command "xrandr" t))
(vga1-dimensions
(let ((group-array
(nth-value 1
(cl-ppcre:scan-to-strings
"(?<=VGA connected).*?(\\d+x\\d+) \\d+\\.\\d+ \\+"
(cl-ppcre:regex-replace-all "\\s+" xrandr-output " ")))))
(if (arrayp group-array) (aref group-array 0)))))