Skip to content

Instantly share code, notes, and snippets.

Pádraig O'Sullivan posulliv

Block or report user

Report or block posulliv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@posulliv
posulliv / gist:3231183
Created Aug 1, 2012
alter statements to create drupal foreign keys
View gist:3231183
-- required for foreign keys on block table (MySQL requirement)
create index module on block(module);
-- required so foreign keys can be created
alter table node_comment_statistics modify column last_comment_uid int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The user ID of the latest author to post a comment on this node, from comment.uid.';
alter table block_custom modify column bid int(11) NOT NULL AUTO_INCREMENT COMMENT 'The block’s block.bid.';
alter table authmap modify column uid int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'User’s users.uid.';
alter table watchdog modify column uid int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The users.uid of the user who triggered the event.';
alter table history modify nid int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The node.nid that was read.';
alter table history modify uid int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The users.uid that read the node nid.';
View gist:6556864
[ RECORD 4 ]-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
View test.php
<?php
$test = '<div>(1) (4) (8) (22) (101)</div>';
$pattern = '/\((\d+)\)/';
$replacement = '<padraig>(${1})</padraig>';
echo preg_replace($pattern, $replacement, $test) . "\n";
?>
View output.md
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 83.58  248.894290        2919     85260      6809 futex
  7.33   21.825363       81743       267           nanosleep
  6.16   18.341146       81156       226           select
  1.56    4.658605         119     39106           fsync
  1.08    3.216201      459457         7         6 restart_syscall
  0.14    0.413560          14     29478           munmap
  0.07    0.205368           7     29478           mmap
View gist:5460161
1955 __memset_sse2,os_aio_linux_collect(string3.h:85),os_aio_linux_handle(string3.h:85),fil_aio_wait(fil0fil.c:4620),io_handler_thread(srv0start.c:482),start_thread,clone,??
1386 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),kwait(toku_pthread.h:294),work_on_kibbutz(toku_pthread.h:294),start_thread,clone,??
397 pthread_cond_timedwait,toku_cond_timedwait(toku_pthread.h:310),minicron_do(toku_pthread.h:310),start_thread,clone,??
200 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),minicron_do(toku_pthread.h:294),start_thread,clone,??
200 pthread_cond_timedwait,toku_cond_timedwait(toku_pthread.h:310),evictor::run_eviction_thread(toku_pthread.h:310),eviction_thread(cachetable.cc:3615),start_thread,clone,??
200 pthread_cond_timedwait,os_cond_wait_timed(os0sync.c:171),os_event_wait_time_low(os0sync.c:171),srv_monitor_thread(srv0srv.c:2171),start_thread,clone,??
200 pthread_cond_timedwait,os_cond_wait_timed(os0sync.c:171),os_event_wait_time_low(os0sync.c:171),srv_lock_timeout_thre
View gist:5459752
1943 __memset_sse2,os_aio_linux_collect(string3.h:85),os_aio_linux_handle(string3.h:85),fil_aio_wait(fil0fil.c:4620),io_handler_thread(srv0start.c:482),start_thread,clone,??
1379 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),kwait(toku_pthread.h:294),work_on_kibbutz(toku_pthread.h:294),start_thread,clone,??
388 pthread_cond_timedwait,toku_cond_timedwait(toku_pthread.h:310),minicron_do(toku_pthread.h:310),start_thread,clone,??
200 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),toku_thread_run_internal(toku_pthread.h:294),start_thread,clone,??
200 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),minicron_do(toku_pthread.h:294),start_thread,clone,??
200 pthread_cond_timedwait,toku_cond_timedwait(toku_pthread.h:310),evictor::run_eviction_thread(toku_pthread.h:310),eviction_thread(cachetable.cc:3615),start_thread,clone,??
200 pthread_cond_timedwait,os_cond_wait_timed(os0sync.c:171),os_event_wait_time_low(os0sync.c:171),srv_monitor_thread(srv0srv.c:2171),start_thread,clone
@posulliv
posulliv / time.md
Created Apr 25, 2013
some strace output
View time.md

command run

strace -c -f -p PID

output

% time     seconds  usecs/call     calls    errors syscall
@posulliv
posulliv / time.md
Created Apr 25, 2013
some strace output
View time.md

command run

strace -c -f -p PID

output

% time     seconds  usecs/call     calls    errors syscall
@posulliv
posulliv / gist:5456995
Last active Dec 16, 2015
A few samples from poor man's profiler. Gathered with pt-pmp ran with options: pt-pmp -p PID -i 200
View gist:5456995
2000 libaio::??(libaio.so.1),os_aio_linux_collect(os0file.c:4539),os_aio_linux_handle(os0file.c:4539),fil_aio_wait(fil0fil.c:4620),io_handler_thread(srv0start.c:482),start_thread(libpthread.so.0),clone(libc.so.6),??
1397 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),kwait(toku_pthread.h:294),work_on_kibbutz(toku_pthread.h:294),start_thread(libpthread.so.0),clone(libc.so.6),??
392 pthread_cond_timedwait,toku_cond_timedwait(toku_pthread.h:310),minicron_do(toku_pthread.h:310),start_thread(libpthread.so.0),clone(libc.so.6),??
200 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),toku_thread_run_internal(toku_pthread.h:294),start_thread(libpthread.so.0),clone(libc.so.6),??
200 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),minicron_do(toku_pthread.h:294),start_thread(libpthread.so.0),clone(libc.so.6),??
200 pthread_cond_timedwait,toku_cond_timedwait(toku_pthread.h:310),evictor::run_eviction_thread(toku_pthread.h:310),eviction_thread(cachetable.cc:3615),start_thread(libpthread.
@posulliv
posulliv / service.json
Created Apr 5, 2013
Akiban service description for Guzzle.
View service.json
{
"apiVersion": "v1",
"serviceFullName" : "Akiban Server",
"signatureVersion" : "v1",
"operations": {
"Version": {
"httpMethod": "GET",
"uri": "/v1/version",
"summary": "Get server version.",
"responseClass": "DataOutput"
You can’t perform that action at this time.