Wednesday, January 23, 2013
Use SSH as a web proxy
ssh user@yourserver.com -L 8080:localhost:3128 -N
Now change your proxy settings to point to localhost:8080
Monday, December 10, 2012
Todoist : Solving cross domain security policy
From https://todoist.com/API/help
Solving cross domain security policy [top]
You cannot use AJAX to directly communicate with Todoist, this is due to browser security policy. You can solve this by communicating with Todoist using a script tag:
var script = document.createElement('script');script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script); |
callbackFunction({ JSON data here }); |
Monday, December 3, 2012
Sunday, December 2, 2012
GNU Screen Cheat-Sheet
Taken from http://neophob.com/2007/04/gnu-screen-cheat-sheet/
Basics: –ctrl a c -> create new window –ctrl a A -> set window name –ctrl a w -> show all window –ctrl a 1|2|3|… -> switch to window n –ctrl a ” -> choose window –ctrl a ctrl a -> switch between window –ctrl a d -> detach window –ctrl a ? -> help –ctrl a [ -> start copy, move cursor to the copy location, press ENTER, select the chars, press ENTER to copy the selected characters to the buffer –ctrl a ] -> paste from buffer How to start screen: –screen –DR -> list of detached screen –screen –r PID -> attach detached screen session –screen –dmS MySession -> start a detached screen session –screen –r MySession -> attach screen session with name MySession Advanced: –ctrl a S -> create split screen –ctrl a TAB -> switch between split screens If you created a new split screen, the current window is empty. either select an existing window (ctrl a ”) or create a new split screen (ctrl a n). –ctrl a Q -> Kill all regions but the current one. –ctrl a X -> remove active window from split screen –ctrl a O -> logout active window (disable output) –ctrl a I -> login active window (enable output)
Thursday, November 29, 2012
Sphinx fails to start with rake ts:start or rake ts:rebuild
$ rake ts:start Failed to start searchd daemon. Check ../log/searchd.log. Failed to start searchd daemon. Check ../log/searchd.log Be sure to run thinking_sphinx:index before thinking_sphinx:startAlmost always is the case for me that searchd is already running / orphaned and needs to be killed. Run
$ps -ax | grep searchdshows that its already running
49630 ttys000 0:00.06 searchd --pidfile --config ../config/development.sphinx.conf 49644 ttys001 0:00.00 perl /usr/local/bin/grep searchdand kill it
$kill -9 49630Voila!
Friday, November 2, 2012
Is there a way through which I see which mysql queries are fired from ActiveRecord in rails console?
http://stackoverflow.com/questions/4667316/how-to-see-mysql-queries-in-rails-console
Yes, this can be achieved through redirecting rails log to standard output.
Write these at your console prompt:
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.connection_pool.clear_reloadable_connections!
Furthermore, you can put these lines in ~/.irbrc file, so that each time you don't need to manually write these 2 lines:
require 'rubygems'
if ENV.include?('RAILS_ENV') && ENV["RAILS_ENV"] == 'development'
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.connection_pool.clear_reloadable_connections!
end
Subscribe to:
Posts (Atom)