Skip to content

Instantly share code, notes, and snippets.

View ltriant's full-sized avatar
🪐
floating

Luke Triantafyllidis ltriant

🪐
floating
View GitHub Profile
@ltriant
ltriant / hexdump.pl
Created May 12, 2020 12:02
hexdump.pl
#!/usr/bin/env perl
# A hex dumping function I use for work purposes.
use warnings;
use strict;
hex_dump("ABCDEFGHIJKLMNOPQRTUVWXYZ0123456789");
sub hex_dump {
my ($payload) = @_;
@ltriant
ltriant / aoc2019-07.rs
Created December 8, 2019 23:45
Advent of Code 2019 Day 7
use std::collections::VecDeque;
use itertools::Itertools;
#[derive(PartialEq)]
enum AddressingMode {
Position,
Immediate,
}
@ltriant
ltriant / life.nim
Last active October 17, 2019 06:09
Conway's Game of Life in Nim
# Conway's Game of Life
#
# Initialises the canvas randomly
#
# nimble install sdl2
# nim c -r life.nim
from random import randomize, rand
import sdl2
@ltriant
ltriant / life.zig
Last active April 8, 2021 02:10
Conway's Game of Life in Zig
// 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({
@ltriant
ltriant / life.c
Last active October 15, 2019 00:29
Conway's Game of Life
/*
* 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>
@ltriant
ltriant / Dockerfile
Created April 23, 2019 23:12
MD5 as a Service
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
#!/usr/bin/env perl
use v5.10;
use warnings;
use strict;
use EV;
use AnyEvent;
use POSIX qw();
#!/usr/bin/env perl
use v5.10;
use warnings;
use strict;
use EV;
use AnyEvent;
# XXX comment this out, and it works
#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();
#!/usr/bin/env perl
use v5.10;
use warnings;
use strict;
use EV;
use AnyEvent;
use Sys::Hostname qw(hostname);