This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(xmas). | |
-export([tree/1]). | |
tree(Width, _, _) when Width < 3 orelse Width > 21 -> | |
error( { out_of_range, { min, 3 }, { max, 21 }, { input, Width } } ); | |
tree(Width, _, _) when Width rem 2 == 0 -> | |
error( { width_is_not_odd, Width } ); | |
tree(Width, Trunk, Leaves) -> | |
lists:foreach( | |
fun (A) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
use Mojo::UserAgent; | |
die "usage: cpanver <module>\n" unless @ARGV; | |
my ($module) = @ARGV; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# mx.psgi -- get geographic information about a domain's mailservers | |
# This was written purely as an example real-world-ish non-blocking | |
# Plack/PSGI application because I'm sick of seeing the usual | |
# "Hello World"-esque examples. | |
# In one shell: | |
# $ feersum --listen :5000 -a mx.psgi | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.10; | |
use warnings; | |
use strict; | |
use EV; | |
use AnyEvent; | |
use Sys::Hostname qw(hostname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
int main(void) | |
{ | |
pid_t pid = fork(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.10; | |
use warnings; | |
use strict; | |
use EV; | |
use AnyEvent; | |
# XXX comment this out, and it works |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.10; | |
use warnings; | |
use strict; | |
use EV; | |
use AnyEvent; | |
use POSIX qw(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM perl:5.28 | |
RUN curl -L http://cpanmin.us | perl - App::cpanminus | |
RUN cpanm Carton | |
COPY app.psgi /app/app.psgi | |
COPY cpanfile /app/cpanfile | |
COPY cpanfile.snapshot /app/cpanfile.snapshot | |
RUN cd /app && carton install --deployment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Conway's Game of Life | |
* | |
* Press any key to re-initialise :) | |
* Click the window to exit. | |
* | |
* gcc -std=c99 -lsdl2 -Wall -Werror -Wpedantic -Wno-unused-function -o life life.c | |
*/ | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Conway's Game of Life | |
// | |
// Initialises the canvas randomly | |
// | |
// zig run life.zig -isystem /usr/local/include --library sdl2 | |
const std = @import("std"); | |
const os = std.os; | |
const warn = std.debug.warn; | |
const c = @cImport({ |
OlderNewer