This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq lexical-binding t) | |
(require 'ht) | |
(defvar *pool* (ht-create) "*POOL*: HN Callback Pool") | |
(defvar *ids* | |
(list | |
"18376741" | |
"18376287" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; hn.el --- convert hacker news post into org-mode buffer -*- lexical-binding: t -*- | |
;; Copyright (C) 2018- Free Software Foundation, Inc. | |
;; Author: Johan Ponin <johan.ponin.pro@gmail.com> | |
;; Version: 0.0.1 | |
;; Package-Version: 20181103.0001 | |
;; Keywords: hackernews, org-mode | |
;; This program is free software; you can redistribute it and/or modify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(progn | |
(defun new-other-buffer () | |
(interactive) | |
(let ((n (generate-new-buffer-name "new"))) | |
(let ((b (get-buffer-create n))) | |
(split-window-right) | |
(switch-to-buffer-other-window b)))) | |
(global-set-key (kbd "C-x 4") #'new-other-buffer)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# file -> ext -> io | |
function rotate () { | |
echo ">>> $*" | |
local f=$1 | |
local e="bak" | |
local t=`date -Iminutes` | |
sudo cp -v $f "${f}.${t}.${e}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clone () { | |
local src=$1 | |
local dst=$2 | |
local min=`date +%F_%Hh%Mm%Ss` | |
local log="/tmp/rsync-$min-$1-to-$2.log" | |
echo "[INFO] logging into $log" | |
rsync -chaux --verbose --progress --stats --delete --log-file=$log "${src}" "${dst}" | |
} | |
clone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun mns (a) | |
(let ((n (symbol-name a))) | |
(if (s-contains? "directory" n) | |
(if (boundp a) | |
(let ((v (symbol-value a))) | |
(if (and v (stringp v) (s-contains? "/usr/share" v)) | |
(message "> %S %s %s" a n v))))))) | |
(mapatoms #'mns) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro defint (name args &rest body) | |
`(defun ,name ,args (interactive) ,@body)) | |
;;; (macroexpand '(defint bash () (ansi-term "/bin/bash"))) | |
(defint bash () (ansi-term "/bin/bash")) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'ctable) | |
(defun ERC-urls () | |
(interactive) | |
(let ((small (lambda (url) (< (length url) 64))) | |
(r '()) | |
(b (current-buffer)) | |
(p (point))) | |
(save-excursion | |
(while (re-search-backward "https?://[[:graph:]]+" nil t) |