2013-06-19

using emacs to manage temporary files during debugging





a.lisp



We always need some temporary files to do editing work.
for example, we got 10000+ line logs to trace bug in it, first thing to do is create a tmp file.

1. To create a tmp file we'd like to
- quick open the files in a directory without naming collision, with short-key `C-; t`
- store the tmp files for future search/grep

;;code
    (defun create-and-open-tmp-file ()
      (interactive)
      (find-file (s-concat
              "~/Documents/hongmin.wang/Google Drive/notes/tmp"
              (format-time-string "%Y%m%d___%H_%M_%S")
              (uuid-string)
              ".temp")))
    (global-set-key (kbd "C-; t") 'create-and-open-tmp-file)

2. To manage versions of tmp file, we like to put it in a git direcotry
   and `C-x v i` to register the tmp file to git
   and `C-x v v` to commit new version of the tmp file to git.

3. sometime, you think the tmp file is no longer an tmp file,
   do a "Save As..." by `C-x C-w`


2013-06-06

record and mock http interactions of third-party server

* Can not setup env in home. so i can not debug my application at home remotely

I am debugging and web application, but I need an ESP fast server to
always return XML data for my search, then I can debug things.

but i can not access the fast server at home, so i can not work remotely at home.

I want have an application to monitor my web application's interactions with
fast server, and recording the interacting data(including delays),
and can replay/mock the services at home.

* python -m SimpleHTTPServer 9000
* http://localhost:9000/null_main.c
* sudo justniffer -i lo0 -r -p "port 9000"
GET /null_main.c HTTP/1.1
Host: localhost:9000
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
If-Modified-Since: Sat, 20 Oct 2012 09:17:23 GMT

HTTP/1.0 200 OK
Server: SimpleHTTP/0.6 Python/2.7.1
Date: Thu, 06 Jun 2013 13:27:41 GMT
Content-type: text/plain
Content-Length: 46
Last-Modified: Sat, 20 Oct 2012 09:17:23 GMT

/* null_main.c */

int main() {
  return 0;
}

* TODO need running the mock server according the recorded http data

-->