Skip to content

Instantly share code, notes, and snippets.

View videlalvaro's full-sized avatar

Alvaro Videla videlalvaro

View GitHub Profile
“The sooner we can forget that FORTRAN has ever existed, the better,
for as a vehicle of thought it is no longer adequate:
it wastes our brainpower, is too risky and therefore too expensive to use”
'I hate a Roman named Status Quo!' he said to me. 'Stuff your eyes with wonder,'
he said, 'live as if you'd drop dead in ten seconds. See the world. It's more
fantastic than any dream made or paid for in factories. Ask no guarantees,
ask for no security, there never was such an animal. And if there were,
it would be related to the great sloth which hangs upside down in a tree all
day every day, sleeping its life away. To hell with that,' he said, 'shake the
tree and knock the great sloth down on his ass.'

<?php
# usage: php add_exchange.php 'images'
include(__DIR__ . '/config.php');
use PhpAmqpLib\Connection\AMQPConnection;
$conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
$ch = $conn->channel();
@videlalvaro
videlalvaro / shift_and.js
Last active January 1, 2016 06:29
This is a vanilla shift_and implementation in JS. Lacking the context it's hard to see what's going on. The interesting part of the algorithm is the bit parallelism techniques it uses to match prefixes. The implementation is based on this book: http://www.amazon.com/Flexible-Pattern-Matching-Strings-Algorithms/dp/0521039932/ Blog post explaining…
/**
* string p: pattern to search (needle);
* string text: haystack
**/
function shift_and(p, text) {
var b = {};
var l = p.length;
var tl = text.length;
// initialize bitmask table
@videlalvaro
videlalvaro / gist:7454226
Created November 13, 2013 18:48
List of algorithms books I've been reading lately
http://www.amazon.com/Flexible-Pattern-Matching-Strings--Line/dp/0521039932/
http://www.amazon.com/Algorithms-Strings-Trees-Sequences-Computational/dp/0521585198/
http://www.amazon.com/Algorithms-Strings-Maxime-Crochemore/dp/0521848997/
http://www.amazon.com/Algorithm-Design-Jon-Kleinberg/dp/0321295358/
include ../umbrella.mk
MAIN_NODE=undefined
OTHER_NODE=undefined
OTHER_PORT=undefined
OTHER_PLUGINS=undefined
BASEDIR=${TMPDIR}/rabbitmq-topic-tests/$(OTHER_NODE)
PID_FILE=$(BASEDIR)/$(OTHER_NODE).pid
start-other-node:
if I run readelf -d /usr/local/lib/erlang/lib/crypto-3.0/priv/lib/crypto.so it depends on this exactly
(NEEDED) Shared library: [libcrypto.so.1.0.0]
is there a way to change that so it will accept libcrypto.so.1.0.1 for example?
NOTE: I tried symlinking libs and that didn't work.
@videlalvaro
videlalvaro / phpunit.xml
Created April 29, 2013 16:52
Sample XML configuration for a PHPUnit RabbitMQ listener
<listeners>
<listener class="RabbitMQListener" file="PhpAmqpLib/Tests/RabbitMQListener.php">
<arguments>
<string>/tmp/rabbitmq-server-mac-standalone-3.0.4.40426.tar.gz</string>
</arguments>
</listener>
</listeners>
@videlalvaro
videlalvaro / RabbitMQListener.php
Created April 29, 2013 15:52
RabbitMQ Listener for PHPUnit
<?php
class RabbitMQListener implements PHPUnit_Framework_TestListener
{
protected $tmp_dir;
protected $rabbit_base;
protected $rabbit_tar;
protected $rabbit_pid;
public function __construct($rabbit_tar)
@videlalvaro
videlalvaro / core.clj
Created September 18, 2012 09:16
macros
(ns claude.core
(:use [clojure.data.json :only [read-json]]))
(defmacro service-value [key]
`(defn ~(symbol (str key)) [] (config ~(str key))))