Skip to content

Instantly share code, notes, and snippets.

@kobapan
kobapan / homepage_watcher.sh
Last active October 11, 2017 08:28
【sh】RSS を配信していないホームページで、指定したhtmlに更新(変化)があった場合に、メールでお知らせする
#! /bin/sh
# RSS を配信していないホームページで、指定したhtmlに更新(変化)があった場合に、メールでお知らせする
# cron で利用する
url=http://hogehoge.ne.jp
title="「ほげほげ」で更新がありました"
[email protected]
[email protected]
@kobapan
kobapan / sudo.el
Last active January 10, 2018 08:11
一般ユーザでemacsを起動しているのに、root権限のフィルを編集したくなることが多かったらこれ
;;; sudo.el ---
;; Author: kobapan <[email protected]>
;; Keywords: emacs,lisp
;; This program 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
;; (at your option) any later version.
@kobapan
kobapan / call-sxiv.el
Last active January 19, 2018 08:08
emacsのdiredでsxivを呼び出して、ディレクトリ内の全画像を表示する。
(defun call-sxiv ()
(interactive)
(let ((image-files;画像ファイル名のリスト
(delq nil;この辺はemacs26辺りで filterマクロに置き換えか?
(mapcar
(lambda (f)
(when (string-match
"\.\\(jpe?g\\|png\\|gif\\|bmp\\)$"
f )
f ))
;;; Depentancy:
;;
;; e2ps
;; ps2pdf
;; sudo apt install e2ps; sudo apt install ghostscript ;
;;; Usage:
;;
;; M-x e2ps-ps2pdf
;; 保存ディレクトリを選ぶ
@kobapan
kobapan / exif.sh
Last active September 29, 2022 00:17
Show or Update the exif ImageDescription and DateTimeOriginal in command line
#!/usr/bin/env bash
# exif.sh
# usage
usage_exit() {
if [[ $1 ]]; then echo "error $1"; fi
echo "---
Usage:
@kobapan
kobapan / eval-print-rs.el
Last active January 23, 2025 01:23
リージョン選択範囲、もしくは直前のS式を読み込み、評価した結果を現在のバッファに挿入する
(defun eval-print-rs ()
"S式を実行して結果を現在のバッファに挿入する
先頭の関数が以下の算術関数だったら行末で ' = ' に続けて印字。それ以外は改行して印字。
abs % mod truncate round floor ceiling sin cos tan expt sqrt
リージョン選択している場合は、リージョン全体を評価。それ以外は、直前のS式を評価。
数字の中に,があるとエラーになるので、削除してから評価する。
"
(interactive)
(let ((s-begin) (s-end)
(math-list '("-" "+" "*" "/" "1+" "1-" "abs" "%" "mod" "truncate" "round" "floor" "ceiling" "sin" "cos" "tan" "expt" "sqrt"))
@kobapan
kobapan / uri-get.scm
Created April 6, 2020 02:33
get html body with uri (Gauche Scheme lisp)
(use rfc.http) ; http-get http-compose-query
(use rfc.uri) ; uri-parse uri-compose
(define (uri-get uri :key (query #f))
(if query (set! uri (string-append uri (if (car query) (http-compose-query "" query)
#"&~(http-compose-query #f (cdr query))"))))
(receive (code status body)
(receive (scheme user-info hostname port path query frament)
(uri-parse uri)
(http-get hostname (uri-compose :path path :query query)))