Skip to content

Instantly share code, notes, and snippets.

@kototama
kototama / scrap.lisp
Created November 3, 2023 20:46
Scrapping a page with Common Lisp
;; see https://github.com/TatriX/cl-selenium-webdriver
(defpackage scrapov
(:use :cl :cl-selenium ))
(in-package :scrapov)
(defparameter *code* "
package main
import \"fmt\"
@kototama
kototama / nethack_change_direction_keys.patch
Created July 17, 2018 15:53
How to change direction keys in NetHack
diff --git a/src/cmd.c b/src/cmd.c
index d7303ec..44bc0b5 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -3927,7 +3927,8 @@ void
reset_commands(initial)
boolean initial;
{
- static const char sdir[] = "hykulnjb><",
+ static const char sdir [] = "nluyi.eh><",
(ns seven.core
(:use clojure.math.combinatorics))
(defn rpn-eval
[e]
(loop [[arg1 arg2 op & nxt] e]
(if (nil? arg2)
arg1
(let [result (try (eval (list op arg1 arg2))
(catch Exception e nil))]
@kototama
kototama / gist:1358405
Created November 11, 2011 16:16
Update the namespace declaration of a Clojure buffer according to its pathname.
(defun clojure-correct-ns
()
"Returns the namespace name that the file should have."
(let* ((nsname ())
(dirs (reverse (split-string (buffer-file-name) "/")))
(aftersrc nil))
(dolist (dir dirs)
(when (not aftersrc)
(if (or (string= dir "src") (string= dir "test"))
(setq aftersrc t)
(defun earmuffy (&optional arg)
(interactive "P")
(let* ((variable (thing-at-point 'sexp))
(bounds (bounds-of-thing-at-point 'sexp))
(current-point (point))
(earmuffed-variable (concat "*" variable "*")))
(save-excursion)
(kill-region (car bounds) (cdr bounds))
(if arg
;; unearmuffy