Skip to content

Instantly share code, notes, and snippets.

View videlalvaro's full-sized avatar

Alvaro Videla videlalvaro

View GitHub Profile
<?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();
'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.'

“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”
@videlalvaro
videlalvaro / gist:9f8b03bff46236bd0a71
Last active August 29, 2015 14:19
You’ve found a bug in Cairngorm.
REASON FIVE: You’ve found a bug in Cairngorm.
If you find a bug in Cairngorm, there’s a really good chance it’s too
early for you to be using it in mission critical projects. I state
this with confidence, because many years ago I was a C developer who
kept finding bugs in Kernighan and Ritchie’s C compiler. Every day,
I’d find something wrong with the compiler – in fact, come to think of
it, I think I was responsible for finding some real clangers in the
Pascal compiler on SunOS as well, back in the day.
%% run this on the CLI:
%% start erlang: erl +K true
c(memory).
%% file size is arbitrary but too big will make the VM crawl with what follows
{ok, Bin} = file:read_file("my_at_least_3MB_file.something").
L = binary_to_list(Bin).
Pid = memory:start().
%% keep N low, a value of 100 makes my VM unresponsive in my 16GB of RAM Retina Mac.
<?php
include(__DIR__ . '/config.php');
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Message\AMQPMessage;
$conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
$ch = $conn->channel();
-module(shiftand).
%% shiftand:match("announce", "annual_announce").
-export([match/2]).
match(Pattern, Text) ->
PatLen = length(Pattern),
BitMaskTable = init_table(Pattern),
MatchMask = 1 bsl (PatLen - 1),
<?php
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Message\AMQPMessage;
use PhpAmqpLib\Wire\AMQPTable;
include(__DIR__ . '/config.php');
$conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
$ch = $conn->channel();
include ../umbrella.mk
http://twitter.com/janl brought me into attention about this interesting piece of code: http://www.davispj.com/2009/11/17/unix-in-python.html and this one: http://pwpwp.blogspot.com/2009/11/unix-in-14-lines-of-ruby-its-trivial.html which is implementing a barebones Unix like system in your favorite language
Here's my take on the game which is some pretty basic Haskell
You can run this code by calling runghc unix.lhs
> import System.IO
> main =
> putStrLn "You have no mail" >> loop
> where
> loop = putStr "$ " >> hFlush stdout >> getLine >>= doCommand