Skip to content

Instantly share code, notes, and snippets.

@posulliv
posulliv / time.md
Created April 25, 2013 05:32
some strace output

command run

strace -c -f -p PID

output

% time     seconds  usecs/call     calls    errors syscall
@posulliv
posulliv / time.md
Created April 25, 2013 02:17
some strace output

command run

strace -c -f -p PID

output

% time     seconds  usecs/call     calls    errors syscall
@posulliv
posulliv / gist:5456995
Last active December 16, 2015 15:39
A few samples from poor man's profiler. Gathered with pt-pmp ran with options: pt-pmp -p PID -i 200
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 April 5, 2013 14:49
Akiban service description for Guzzle.
{
"apiVersion": "v1",
"serviceFullName" : "Akiban Server",
"signatureVersion" : "v1",
"operations": {
"Version": {
"httpMethod": "GET",
"uri": "/v1/version",
"summary": "Get server version.",
"responseClass": "DataOutput"
@posulliv
posulliv / simple.php
Last active December 15, 2015 19:59
simple PHP example
<?php
require_once 'vendor/autoload.php';
use Guzzle\Http\Client;
use Guzzle\Service\Description\ServiceDescription;
$client = new Client('http://localhost:8091/');
$response = $client->get('/v1/version')->send();
@posulliv
posulliv / geo.md
Created March 8, 2013 16:26
Simple walk through of Spatial features in Akiban and how to do simple nearest-neighbor query.

Enabling Akiban Geospatial Queries

The following needs to be in your server.properties file:

akserver.postgres.parserGeospatialIndexes=true

Table and Data

1) install drupal & apache & akiban
wget http://ftp.drupal.org/files/projects/drupal-7.17.tar.gz
tar zxvf drupal-7.17.tar.gz
sudo apt-get update
sudo apt-get install -y python-software-properties
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 0AA4244A
sudo add-apt-repository "deb http://software.akiban.com/apt-developer/ lucid main"
sudo apt-get update
sudo apt-get install -y apache2 php5-pgsql php5-gd libapache2-mod-php5 php-apc postgresql-client akiban-server
@posulliv
posulliv / gist:3231183
Created August 1, 2012 22:16
alter statements to create drupal foreign keys
-- 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.';
sudo apt-get install pgbouncer
# edit /etc/pgbouncer/pgbouncer.ini file
# edit /etc/default/pgbouncer file and set START=1
sudo service pgbouncer start
contents of /etc/pgbouncer/pgbouncer.ini file
[databases]
drupal = host=127.0.0.1 port=5432 dbname=drupal
1) install drupal & apache
wget http://ftp.drupal.org/files/projects/drupal-7.12.tar.gz
tar zxvf drupal-7.12.tar.gz
sudo apt-get install apache2 php5-pgsql php5-gd libapache2-mod-php5 php-apc
sudo mkdir /var/www/drupal
sudo mv drupal-7.12/* drupal-7.12/.htaccess /var/www/drupal
sudo cp /var/www/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php
sudo chown www-data:www-data /var/www/drupal/sites/default/settings.php
sudo mkdir /var/www/drupal/sites/default/files