Skip to content

Instantly share code, notes, and snippets.

View MartinEnders's full-sized avatar
🤪

Dr. Martin Enders MartinEnders

🤪
View GitHub Profile
@MartinEnders
MartinEnders / ticketnummern.lisp
Last active December 1, 2015 08:42
Berechnung Ticketnummern
;;; ticket berechnung
(defparameter *start-base* 9001000000)
(defparameter *ticket-count* 500000)
(defparameter *paeckchen* 5)
(defparameter *spalten* 9)
(defparameter *zeilen* 20) ;;; oder 20
(defparameter *blaetter* (1+ (floor (/ *ticket-count* (* *spalten* *zeilen*))))) ;; passt nicht bei teilen ohne rest
@MartinEnders
MartinEnders / pdf-to-output-stream.lisp
Last active December 3, 2015 08:10
Write pdf to stream with cl-pdf
;;; Dritte Mail: http://sourceforge.net/p/sbcl/mailman/message/23021940/
;;; :element-type :default (http://www.sbcl.org/manual/index.html#Bivalent-Streams)
;;; *compress-streams*: http://stackoverflow.com/questions/3970001/cl-pdf-output-error
(setf pdf:*compress-streams* nil)
@MartinEnders
MartinEnders / inotifywait-called-from-lisp.lisp
Last active January 2, 2016 18:48
Calling inotifywait from common lisp to monitor files and read output of inotifywait from stream
;;; Monitor Folder for changes on files with inotifywait (install with aptitude or apt-get on debian or raspbian)
;;; For inforamation about inotifywait: man inotifywait
;;; Requirements
;;; inotifywait (aptitude or apt-get install inotifywait)
;;; sbcl, ccl, ...
;;; quicklisp
;;; Example-run:
;;; REPL: (start-monitoring)
@MartinEnders
MartinEnders / synchronization.lisp
Last active January 11, 2016 15:08
increment and decrement in threads with and without lock / synchronization
(ql:quickload "bordeaux-threads")
(defparameter *count* 0)
(defparameter *count-unlock* 0)
(defparameter *lock* (bt:make-lock))
(defun thread-test()
(let ((t1 (bt:make-thread #'(lambda () (loop repeat 100000 do
@MartinEnders
MartinEnders / round-robin-queue-test.lisp
Created January 21, 2016 20:41
Round Robin Queue in common lisp without synchronization but pretty fast
(ql:quickload :bordeaux-threads)
(setf *print-circle* t)
(defparameter *list* nil)
(defparameter *read* nil)
(defparameter *write* nil)
(defun init ()
(setf *list* (loop repeat 100 collect nil)) ;; create list
(setf *read* *list*) ;; read pointer on list
@MartinEnders
MartinEnders / split.lisp
Last active February 11, 2016 16:01
Common Lisp cl-ppcre:split and split-sequence:SPLIT-SEQUENCE behavior
(ql:quickload :split-sequence)
(ql:quickload :cl-ppcre)
; PROBLEM:
; I have to convert the OBX-5 field of HL7-Messages (MDM T07 document edit notification)
; that the empty components are replaced with "" so that the receiving system recoginzes
; that there is a change and updates its database.
; EXAMPLE:
; OBX|1||||bla^fasl^^^^||| should be OBX|1||||bla^fasl^""^""^""^""|||
@MartinEnders
MartinEnders / redis-test.lisp
Last active February 20, 2016 14:46
Common Lisp Redis Test
;; Ensure that a Redis installation is availabel on localhost
;; I set the follewing parameter to prevent redis from writing to disk (/etc/redis/redis.conf):
;; save ""
(defun init ()
"Load cl-redis and initialize the connection"
(ql:quickload :cl-redis)
(redis:disconnect)
(redis:connect)
(red:ping))
@MartinEnders
MartinEnders / redis-lisp-raspberrypi-pipelining-test.lisp
Created February 27, 2016 19:39
writing to redis on raspberrypi over wireless lan with and without pipelining
;;; Redis: writing to redis on raspberrypi (sensors-owb01) over wireless lan with and without pipelining
(defparameter *test* nil)
(defun redis-test ()
(print "-------------- MIT PIPELINING ------------------")
;; aufraemen
(setf *test* nil)
@MartinEnders
MartinEnders / spamfilter-setup-postfix-dovecot.md
Last active January 29, 2022 21:27
Setup of spamfilter and sieve for postfix and dovecot

Packetinstallation

aptitude install spamassassin razor pyzor rsyslog
aptitude install amavisd-new
aptitude install dovecot-sieve dovecot-lmtpd
aptitude install clamav clamav-daemon
# restart freshclam and clamav-daemon when error messages occour:
# [FAIL] Clamav signatures not found in /var/lib/clamav ... failed!
@MartinEnders
MartinEnders / create-iso8601-timestamp.md
Last active April 15, 2016 14:00
Create iso8601 timstamp string in python