Sep 21, 2016

Install memcached in Mac OS El Capitan

The easiest way to install memcached is to use homebrew package installer:

$ brew install memcached

This locates memcached in /usr/local/opt/memcached/bin/

Starting memcached (by default at port 11211 or with -p port_number):

$ memcached -p 9000

To have launchd start memcached now and restart at login:

$ brew services start memcached

To change the default ram size (64mb) used by memcached use -m option:
$ memcached -m 128  -p 9000

Lastly, run memcached as a daemon with -d:

$ memcached -d -p 9000

Jul 20, 2016

Install compass in Mac Os El Capitan

$ sudo gem install compass is not working?

Do you have ruby installed?
If not install it using brew:

$ sudo brew install ruby 

First try updating your gem version:

$ sudo gem update --system

Then try again installing compass:

$ sudo gem install compass

Oh... now you get a:

Fetching: compass-1.0.3.gem (100%)
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/compass

Run the following:

$ sudo gem install -n /usr/local/bin compass


Dec 27, 2015

"Bad programmers worry about the code. Good programmers worry about data structures and their relationships."
Linus Torvalds

Dec 1, 2015

Python Ipdb Cheatsheet

Command CheatSheet

  1. h(elp):
    Without argument, print the list of available commands. With a command name as argument, print help about that command.
  2. w(here): Print a stack trace, with the most recent frame at the bottom. An arrow indicates the “current frame”, which determines the context of most commands.
  3. d(own): Move the current frame one level down in the stack trace (to a newer frame).
  4. u(p): Move the current frame one level up in the stack trace (to an older frame).
  5. b(reak): [ ([filename:]lineno | function) [, condition] ]
    With a filename:line number argument, set a break there. If filename is omitted, use the current file. With a function name, set a break at the first executable line of that function. Without argument, list all breaks. Each breakpoint is assigned a number to which all the other breakpoint commands refer.
    The condition argument, if present, is a string which must evaluate to true in order for the breakpoint to be honored.
  6. tbreak: [ ([filename:]lineno | function) [, condition] ]
    Temporary breakpoint, which is removed automatically when it is first hit. The arguments are the same as break.
  7. cl(ear): [bpnumber [bpnumber …] ]
    With a space separated list of breakpoint numbers, clear those breakpoints. Without argument, clear all breaks (but first ask confirmation).
  8. disable bpnumber: [bpnumber …]
    Disables the breakpoints given as a space separated list of breakpoint numbers. Disabling a breakpoint means it cannot cause the program to stop execution, but unlike clearing a breakpoint, it remains in the list of breakpoints and can be (re-)enabled.
  9. enable bpnumber: [bpnumber …]
    Enables the breakpoints specified.
  10. ignore bpnumber count:
    Sets the ignore count for the given breakpoint number. If count is omitted, the ignore count is set to 0. A breakpoint becomes active when the ignore count is zero. When non-zero, the count is decremented each time the breakpoint is reached and the breakpoint is not disabled and any associated condition evaluates to true.
  11. condition bpnumber condition:
    condition is an expression which must evaluate to true before the breakpoint is honored. If condition is absent, any existing condition is removed; i.e., the breakpoint is made unconditional.
  12. s(tep):
    Execute the current line, stop at the first possible occasion (either in a function that is called or in the current function).
  13. n(ext):
    Continue execution until the next line in the current function is reached or it returns.
  14. unt(il):
    Continue execution until the line with a number greater than the current one is reached or until the current frame returns.
  15. r(eturn):
    Continue execution until the current function returns.
  16. run [args…]:
    Restart the debugged python program. If a string is supplied it is splitted with “shlex”, and the result is used as the new sys.argv. History, breakpoints, actions and debugger options are preserved. “restart” is an alias for “run”.
  17. c(ont(inue)):
    Continue execution, only stop when a breakpoint is encountered.
  18. l(ist): [first [,last]]
    List source code for the current file. Without arguments, list 11 lines around the current line or continue the previous listing. With one argument, list 11 lines starting at that line. With two arguments, list the given range; if the second argument is less than the first, it is a count.
  19. a(rgs):
    Print the argument list of the current function.
  20. p expression:
    Print the value of the expression.