escape from heroku
backup db of app
heroku pgbackups:capture -a $app-staging heroku pgbackups:capture -a $app-demo heroku pgbackups:capture -a $app-production
curl -o staging.dump `heroku pgbackups:url -a $app-staging` curl -o demo.dump `heroku pgbackups:url -a $app-demo` curl -o prod.dump `heroku pgbackups:url -a $app-production`
upload to ec2
scp *.dump admin@EC2IP:
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U rails -d $app_dev staging.dump pg_restore --verbose --clean --no-acl --no-owner -h localhost -U rails -d $app_demo demo.dump pg_restore --verbose --clean --no-acl --no-owner -h localhost -U rails -d $app_production prod.dump
https://www.padory.com/ 是一个用 Go 语言写的知识分享的社区网站, 运行已经有大半年, 今天把它给关了，因为我完全不懂也没有足够的时间去好好运营一个社区网站. 就像博客一样, 也是当年 (2011) 一时心血来潮搭起来的. 当时自己并没有想过怎样去写好博客, 就拿一些技术记录来充数, 到现在也一样, 只不过都运行这么几年了, 关闭了有点可惜.
Implement the "->" operator of Clojure: http://clojuredocs.org/clojure_core/clojure.core/-%3E in CL, that's funny.
Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc.
(defmacro -> (x &optional (form nil form-supplied-p) &rest more) (if form-supplied-p (if more `(-> (-> ,x ,form) ,@more) (if (listp form) `(,(car form) ,x ,@(cdr form)) (list form x))) x))
How does it works?
CL-USER> (-> 1 (+ 1) (+ 2) (+ 3)) 7 CL-USER>
=== (+ (+ (+ 1 1) 2) 3)
See another example:
CL-USER> (-> 10 (- 5) (- 5) (- 5)) -5 CL-USER>
=== (- (- (- 10 5) 5) 5)
How if I want (- 5 (- 5 (- 5 10)))?
There is ->> to do this. http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E
Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc.
(defmacro ->> (x &optional (form nil form-supplied-p) &rest more) (if form-supplied-p (if more `(->> (->> ,x ,form) ,@more) (if (listp form) `(,(car form) ,@(cdr form) ,x) (list form x))) x))
This one looks more useful sometimes.
CL-USER> (->> (list 1 2 3 4 5) (reduce '+) (* 2) (- 5)) -25 CL-USER>
=== (- 5 (* 2 (reduce '+ '(1 2 3 4 5))))
NeoTree is more lightweight and simple.
;; (require 'sr-speedbar) ;; (make-face 'speedbar-face) ;; (set-face-font 'speedbar-face "DejaVu Sans Mono-11") ;; (setq speedbar-use-images nil) ;; (setq sr-speedbar-delete-windows t) ;; (setq sr-speedbar-right-side nil) ;; (setq sr-speedbar-width-x 25) ;; (setq sr-speedbar-width-console 25) ;; (setq sr-speedbar-max-width 30) ;; (setq speedbar-verbosity-level 0) ;; (setq sr-speedbar-skip-other-window-p t) ;; install neotree by ELPA ;; use neotree instead (require 'neotree) (setq neo-window-width 28)
how they looks?
Here is an experience on setting up a 3-nodes-hbase-cluster(1 name-node and 2 data-node) on AWS EC2.
Hunchentoot - The Common Lisp web server formerly known as TBNL
Hunchentoot is a web server written in Common Lisp and at the same time a toolkit for building dynamic websites. As a stand-alone web server, Hunchentoot is capable of HTTP/1.1 chunking (both directions), persistent connections (keep-alive), and SSL.
By default, hunchentoot supports cookies, but all cookies will be exposed once a request was done from the client. And there is not a solution to secure the cookies transform by now in hunchentoot. So the temporary choice is using the hunchentoot session:
create a small "mini pad" from emacs by
(defun make-mini-pad () (interactive) (make-frame '( (name . "mini") (width . 72) (height . 39))))
(defun getenv (var) #+cmu (cdr (assoc (if (symbolp var) var (intern var :keyword)) ext:*environment-list*)) #+sbcl (sb-ext:posix-getenv (string var)) #+lispworks (hcl:getenv var) #+clisp (ext:getenv (string var)) #+allegro (sys:getenv (string var)) #-(or cmu sbcl lispworks clisp allegro) (error "GETENV not implemented for your Lisp platform."))
Sometimes the file system get corrupted and hence you may unable to boot your system. In such case you will need to repair the corrupted file system. In Linux you can repair it using fsck command. In windows we have command chkdsk. In OSX we have "fsck", "fsck_hfs".
There are several reasons behind the file system corruption. For example, improper shutdown, suddenly cut off the power supply, a storage device was removed when system is in process to write the data on it, accidental system file deletion and viruses can cause file corruption and unstable system. Some file corruptions are less harmful and user can continue working. However it is important to run a “fsck” once in a while as a practice.
Why time machine?
Time Machine is Apple's built-in backup solution for OS X that creates hourly backups of all files on the system. It takes many snapshots of your local drive, copies many millions of files to the backup disk volume. By default, Checking the time machine disk volumes with Disk Utility, can be painfully slow, taking many hours or days to complete, if it completes at all.
Find the time machine disk, open Terminal.app, type
diskutils list, find the line contains Apple_HFS YOUR_DISK_NAME, get the device name from the last column below IDENTIFIER, for example, disk3, disk4...
Run fsck_hfs with 2G memory cache:(adjust less than the system memory)
sudo fsck_hfs -f -y -c 2g /dev/disk3
The key is to increase the size of the cache used by
fsck_hfs. see more from manual:
-c size Specify the size of the cache used by fsck_hfs internally. Bigger size can result in better performance but can result in deadlock when used with -l option. Size can be specified as a decimal, octal, or hexadec- imal number. If the number ends with a ``k'', ``m'', or ``g'', the number is multiplied by 1024 (1K), 1048576 (1M), or 1073741824 (1G), respectively.