Skip to content

Instantly share code, notes, and snippets.

View parallel588's full-sized avatar

Maksim Pechnikov parallel588

  • WELLNUTS
  • Tampere
View GitHub Profile
<div style="text-align: center">
<script type="text/javascript" src="http://www.kaltura.com/p/874892/sp/87489200/embedIframeJs/uiconf_id/7218852/partner_id/874892"></script><object id="kaltura_player_1335237510" name="kaltura_player_1335237510" type="application/x-shockwave-flash" allowfullscreen="true" allownetworking="all" allowscriptaccess="always" height="450" width="500" bgcolor="#000000" xmlns:dc="http://purl.org/dc/terms/" xmlns:media="http://search.yahoo.com/searchmonkey/media/" rel="media:video" resource="http://www.kaltura.com/index.php/kwidget/cache_st/1335237510/wid/_874892/uiconf_id/7218852/entry_id/1_qjhijm22" data="http://www.kaltura.com/index.php/kwidget/cache_st/1335237510/wid/_874892/uiconf_id/7218852/entry_id/1_qjhijm22"><param name="allowFullScreen" value="true"><param name="allowNetworking" value="all"><param name="allowScriptAccess" value="always"><param name="bgcolor" value="#000000"><param name="flashVars" value="&amp;{FLAVOR}"><param name="movie" value="http://www.kaltura.com/index.ph
@parallel588
parallel588 / group
Created February 20, 2012 11:25
mongo_group
@map_function = "
function(log) {
var pad = function(n) {return n<10 ? '0'+n : n}
var date = new Date(log.created_at);
var d = pad(date.getFullYear()) + '-' + pad(date.getMonth()+1) + '-' + pad(date.getDate());
return { group_period: d };
}"
@reduce_function = " function(doc, out) { out.count++; } "
@parallel588
parallel588 / gist:1633887
Created January 18, 2012 16:31
Dump remote production postgresql database, rsync to localhost
desc "Dump remote production postgresql database, rsync to localhost"
task :postgresql do
get("#{current_path}/config/database.yml", "tmp/database.yml")
remote_settings = YAML::load_file("tmp/database.yml")[rails_env]
local_settings = YAML::load_file("config/database.yml")["development"]
run "export PGPASSWORD=#{remote_settings["password"]} && pg_dump --host=#{remote_settings["host"]} --port=#{remote_settings["port"]} --username #{remote_settings["username"]} --file #{current_path}/tmp/#{remote_settings["database"]}_dump -Fc #{remote_settings["database"]}"
run_locally "rsync --recursive --times --rsh=ssh --compress --human-readable --progress #{user}@#{shared_host}:#{current_path}/tmp/#{remote_settings["database"]}_dump tmp/"
@parallel588
parallel588 / gist:972228
Created May 14, 2011 13:53 — forked from ebeigarts/gist:970898
html2haml recursive
for f in `find . -regex '.*\.html\.erb'`; do echo "Converting $f" && html2haml $f > "${f%.erb}.haml" && rm $f; done