Skip to content

Instantly share code, notes, and snippets.

View wwalker's full-sized avatar

Wayne Walker wwalker

View GitHub Profile
on linux (CentOS 4 or 5) how can I control client buffering? I need
the client to cache writes longer. I have an app that does 100s of
thousands of 1 to 8 KB writes. When I wrote a C program to do that,
I get 50 MB /sec (1024 writes of 1024 bytes). The application however
(proprietary, similar to an app based on say Berkeley DB) gets 4 MB/sec.
if I move the app onto the file server and run it I get about 40 MB/sec,
sustained, so there seems to be no problem with the file system involved.
If I put fsync between my 1 K writes, I get about 0.1 MB sec (100 writes
per second roughly). 10 times slower than the third party app.
Process 25919 attached - interrupt to quit
read(7 1024) = 1024
time(NULL) = 1245034358
_llseek(4 SEEK_SET) = 0
read(4 16) = 16
_llseek(4 SEEK_CUR) = 0
read(4 7813) = 7813
time(NULL) = 1245034358
_llseek(4 SEEK_SET) = 0
read(4 16) = 16
select a.id, max(delivered_at) as last_delivery from alerts a join attempts at on at.alert_id = a.id group by a.id;
That select returns what I want to update alerts with. So I tried to write an update with GROUP and JOIN.
mysql> update alerts a join attempts att on att.alert_id = a.id set completed_at = max(delivered_at) group by a.id;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group by a.id' at line 1
It failed....
Can I do this update in SQL, or do I have to write a script in perl python or ruby?
def alert_lists_for_media_type
media_type = message.media_type
usable_lists = alert_lists.select{|al|
al.list.contacts.select{|c|
! c.get_address_for_media_type(media_type).empty?
}.length > 0
}
return usable_lists
end
procmail: Match on "^X-CRM114-Status:.*SPAM"
procmail: Match on ! "(^(Mailing-List:|Precedence:.*(junk|bulk|list)|To: Multiple re
cipients of |(((Resent-)?(From|Sender)|X-Envelope-From):|>?From )([^>]*[^(.%@a-z0-9]
)?(Post(ma?(st(e?r)?|n)|office)|(send)?Mail(er)?|daemon|m(mdf|ajordomo)|n?uucp|LIST(
SERV|proc)|NETSERV|o(wner|ps)|r(e(quest|sponse)|oot)|b(ounce|bs\.smtp)|echo|mirror|s
(erv(ices?|er)|mtp(error)?|ystem)|A(dmin(istrator)?|MMGR|utoanswer))(([^).!:a-z0-9][
-_a-z0-9]*)?[%@> ][^<)]*(\(.*\).*)?)?$([^>]|$)))"
procmail: Match on ! "^X-Loop: [email protected]"
procmail: Assigning "LASTFOLDER=crm114_spam"
procmail: Opening "crm114_spam"
[wwalker@silver ~]$ list_processor
Missing the Rails 2.2.2 gem. Please `gem install -v=2.2.2 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
[wwalker@silver ~]$ gem list rails
*** LOCAL GEMS ***
rails (2.2.2)
@wwalker
wwalker / gist:161235
Created August 4, 2009 13:53
ahn_quick_start
1. in extensions.conf create a context that dumps into agi:
[my_ahn_app]
exten => s,1,AGI(agi://127.0.0.1)
2. ahn create my_proj
cd my_proj
ahn create my_component
vim components/my_component/my_component.rb
methods_for :dialplan do
@wwalker
wwalker / gist:168773
Created August 16, 2009 21:41
SQL Beautifier / SQL Formatter
#!/usr/bin/perl -w
use strict;
use SQL::Beautify;
my $sql_query = "";
while (<>) {
$sql_query .= $_;
}
=CRASH REPORT==== 21-Aug-2009::18:55:59 ===
crasher:
pid: <0.501.0>
registered_name: []
exception exit: {{case_clause,
{function_clause,
[{lists,foreach,
[#Fun<node_default.0.66576442>,
{'EXIT',
=INFO REPORT==== 2009-08-21 18:55:57 ===
I(<0.281.0>:ejabberd_listener:112) : (#Port<0.720>) Accepted connection {{75,27,136,30},49427} -> {{72,249,9,98},5222}
=INFO REPORT==== 2009-08-21 18:55:57 ===
I(<0.501.0>:ejabberd_c2s:681) : ({socket_state,tls,{tlssock,#Port<0.720>,#Port<0.722>},<0.500.0>}) Accepted authentication for wwalker
=INFO REPORT==== 2009-08-21 18:55:58 ===
I(<0.501.0>:ejabberd_c2s:793) : ({socket_state,tls,{tlssock,#Port<0.720>,#Port<0.722>},<0.500.0>}) Opened session for [email protected]/Gaim