Skip to content

Instantly share code, notes, and snippets.

View svetlyak40wt's full-sized avatar
💭
Making Ultralisp.org

Alexander Artemenko svetlyak40wt

💭
Making Ultralisp.org
View GitHub Profile
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements/production.txt requirements/production.in
#
alabaster==0.7.8 # via sphinx
anyjson==0.3.3
argparse==1.4.0 # via dateutils
@svetlyak40wt
svetlyak40wt / request.sh
Created August 6, 2016 10:42 — forked from nuxlli/unix_socket_request.sh
Examples of http request (in unix domain socket) with bash and [nc|socat]
#!/bin/bash
# References
# http://www.computerhope.com/unix/nc.htm#03
# https://github.com/daniloegea/netcat
# http://unix.stackexchange.com/questions/26715/how-can-i-communicate-with-a-unix-domain-socket-via-the-shell-on-debian-squeeze
# http://unix.stackexchange.com/questions/33924/write-inside-a-socket-open-by-another-process-in-linux/33982#33982
# http://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip
# http://www.dest-unreach.org/socat/
# http://stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-1.7.1.2/EXAMPLES
@svetlyak40wt
svetlyak40wt / postmodern.rst
Created August 11, 2016 17:38
Example of lostforks command

marijnh/Postmodern

radisb/Postmodern

master

@svetlyak40wt
svetlyak40wt / drf-extensions.rst
Last active August 12, 2016 07:48
Another example of lost-forks script.

chibisov/drf-extensions

christinegraham/drf-extensions

gh-pages

@svetlyak40wt
svetlyak40wt / olaf-example.lips
Created August 29, 2016 17:21
A snippet to build react apps with Common Lisp
(load "olaf.lisp")
(import "react" "React")
(defclass todo-app ()
(defun get-initial-state ()
(create todos (list :a :b :c) current ""))
(defun render-todo-item (item index)
(dom ((:li :key index) item)))
@svetlyak40wt
svetlyak40wt / type-constraint.lisp
Last active October 13, 2016 07:42
Пример проверки дополнительных условий для типов в Common Lisp
;;; Пример проверки дополнительных условий для типов в Common Lisp
(defun equidimensional (a)
(or (< (array-rank a) 2)
(apply #'= (array-dimensions a))))
;; тут мы определяем тип, который представляет собой
;; матрицу, все размерности которой одинаковы
(deftype square-matrix (&optional type size)
`(and (array ,type (,size ,size))
(defpackage heart
(:use :cl))
(in-package :heart)
;; Usage:
;; sbcl -l heart.lisp -e '(uiop:quit 0)'
;;
(defun print-line (&rest args)
(loop
1 compiler notes:
test-who-with-iterate.lisp:13:6:
warning:
Iterate, in clause (LET ((S S))
(CHECK-TYPE S STREAM)
(MACROLET ((HTM (&BODY BODY)
`(WITH-HTML-OUTPUT (,'S NIL PROLOGUE NIL
INDENT ,NIL)
,@BODY))
@svetlyak40wt
svetlyak40wt / convert-3party-function-into-generic.lisp
Created December 30, 2016 06:52
Example, how to patch 3party library on fly, converting a ordinal function into a generic.
(setf (fdefinition 'original-report-expected-line)
#'prove.reporter.list::report-expected-line)
(defgeneric report-expected-line (report)
(:documentation "Returns a line which describes a problem with failed test."))
(defmethod report-expected-line (report)
"Default behaviour is to call original Prove's function,
which formats a string, comparing two values."
(original-report-expected-line report))
#!/usr/bin/env python
from hamcrest import (
assert_that,
has_entries,
is_not,
)
obj = {'foo': 'bar', 'other': 'key'}