Skip to content

Instantly share code, notes, and snippets.

@lfittl
lfittl / gist:797583
Created January 26, 2011 22:07
Cronjob script for syncing mongrel2 fossil to git
#!/bin/bash
echo "*** STARTING SYNC `date` ***" >> /root/sync.log
/root/fossil/fossil pull -R /root/mongrel2.fossil http://mongrel2.org:44445/ >> /root/sync.log
cd /root/mongrel2
/root/fossil/fossil export -R /root/mongrel2.fossil | git fast-import --quiet >> /root/sync.log
git push --all origin >> /root/sync.log 2>&1
echo "*** FINISHED SYNC `date` ***" >> /root/sync.log
@lfittl
lfittl / gist:797522
Created January 26, 2011 21:36
Fix for fossil's git export function
diff --git a/src/export.c b/src/export.c
index d776854..2a91805 100644
--- a/src/export.c
+++ b/src/export.c
@@ -41,7 +41,7 @@ static void print_person(const char *zUser){
db_reset(&q);
for(i=0; zUser[i] && zUser[i]!='>' && zUser[i]!='<'; i++){}
if( zUser[i]==0 ){
- printf(" <%s>", zUser);
+ printf(" %s <%s>", zUser, zUser);
Program received signal SIGSEGV, Segmentation fault.
bstr2cstr (b=0x1, z=0 '\0') at src/bstr/bstrlib.c:281
281 if (b == NULL || b->slen < 0 || b->data == NULL) return NULL;
(gdb) bt
#0 bstr2cstr (b=0x1, z=0 '\0') at src/bstr/bstrlib.c:281
#1 0x00000000004285a3 in connection_http_to_handler (conn=0x1e3e078) at src/connection.c:217
#2 0x000000000042910a in State_exec (state=0x1e3e0a0, event=0, conn=0x1e3e078) at src/state.rl:58
#3 0x00000000004277f0 in Connection_task (v=<value optimized out>) at src/connection.c:567
#4 0x000000000040c54f in taskstart (y=<value optimized out>, x=<value optimized out>) at src/task/task.c:35
#5 0x00007f90447e97b0 in ?? () from /lib/libc.so.6
We couldn’t find that file to show.
def refresh_feed
# ..
begin
# ..
rescue => e
Exceptional.log_frontend(e, self, request, params.merge(:feed_id => params[:id]))
end
end
STAT pid 6171
STAT uptime 1784170
STAT time 1252708803
STAT version 1.4.0
STAT pointer_size 64
STAT rusage_user 330.248639
STAT rusage_system 795.349706
STAT curr_connections 46
STAT total_connections 29370
STAT connection_structures 72
---
memcache.in.soup.io:session:
bytes: 270723149
cas_misses: 0
delete_hits: 0
get_hits: 10405912
rusage_system: 230.57441
pid: 5261
cas_hits: 0
incr_misses: 0
javascript:%0Avar%20es=['body','frameset','head'];%0Avar%20u='http://www.soup.io/';%0Avar%20fn='soup_bookmarklet_'+(Math.floor(Math.random()*100000));%0Avar%20w=window.top;%0A%0Awindow.open(u+'bookmarklet-loading.html',fn,'toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=400');%0A%0Atry%0A%7B%0A%20%20var%20s=w.document.createElement('script');%0A%20%20s.setAttribute('src',u+'bookmarklet/js/'+%20fn%20+'/5');%0A%20%20for%20(var%20i=0;i%3Ces.length;i++)%7B%0A%20%20%20%20var%20e=w.document.getElementsByTagName(es[i])[0];%0A%20%20%20%20if(e)%7B%0A%20%20%20%20%20%20e.appendChild(s);%0A%20%20%20%20%20%20break;%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0Acatch(e)%0A%7B%0A%20%20alert(%22This%20doesn't%20work%20here.%22);%0A%7D%0Avoid(0);%0A
soup_production=> EXPLAIN ANALYZE SELECT posts.id, posts.created_at FROM posts JOIN blogs ON (blogs.id = posts.blog_id) JOIN user_friend ON (blogs.user_id = user_friend.friend_id) WHERE user_friend.user_id = 2 ORDER BY posts.created_at DESC, posts.id DESC LIMIT 40;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.00..2192.72 rows=40 width=16) (actual time=0.584..46.198 rows=40 loops=1)
-> Nested Loop (cost=0.00..6837657.43 rows=124734 width=16) (actual time=0.583..46.186 rows=40 loops=1)
-> Nested Loop (cost=0.00..3748680.73 rows=24974683 width=24) (actual time=0.033..26.752 rows=5245 loops=1)
-> Index Scan Backward using posts_for_friendposts on posts (cost=0.00..2110713.79
Limit (cost=0.00..620.06 rows=40 width=16) (actual time=1.187..55.320 rows=40 loops=1)
-> Index Scan Backward using posts_for_friendposts on posts (cost=0.00..2698009.85 rows=174048 width=16) (actual time=1.186..55.305 rows=40 loops=1)
Filter: (blog_id = ANY ('{10,168485,34010,153723,2328,50727,50227,151291,137223,16891,108471,42878,139618,115804,2664,79,122698,129025,119355,122050,27614,7,1,4,8,9,11,12,15,23,24,32,41,47,10470,56,60,67,70,82,1912,2093,2252,2292,4431,7359,13163,13454,17771,27687,28251,35620,11139,28895,22987,30864,864,35835,36914,19306,14356,2367,23299,48,871,27,35725,94511,53870,43202,69,64245,76507,43870,78181,55870,48082,57072,57187,63113,64,9542,36937,46332,56926,60464,8274,22585,9380,55473,60938,28799,37935,33073}'::bigint[]))
Total runtime: 55.364 ms