Skip to content

Instantly share code, notes, and snippets.

View Cheezmeister's full-sized avatar
🧀

Brendan Luchen Cheezmeister

🧀
View GitHub Profile
@Cheezmeister
Cheezmeister / aoc.pl.md
Last active November 7, 2018 01:25
AoC 2017

#!liberate perl

These are my solutions to 2017's Advent of Code puzzles! Last year, I did most of the problems in Elixir, a mostly-new language for me. This year, I'm using Perl for two reasons:

  • It's what AoC is built in (citation needed)
  • I've always wanted to wield a Swiss-army chainsaw

But not just any Perl. No, this Perl is literate!

#!/usr/bin/perl
use warnings;
use strict;
# IMPORTS
#
use Switch;
use List::Util qw[min max];

se proof

I hereby claim:

  • I am cheezmeister on github.
  • I am cheezmeister (https://keybase.io/cheezmeister) on keybase.
  • I have a public key ASDFURBqT5Auo_5NVT3wvYi8_9lvo-PCPw_GbTWiekz8Ngo

To claim this, I am signing this object:

def decompress("") do
""
end
def handle_repeat(input) do
re = ~r/(\d+)x(\d+)\)(.*)/
[_, len, repeats, rest] = Regex.run re, input
{section, remainder} = rest |> String.split_at(String.to_integer(len))
(section |> String.duplicate(String.to_integer repeats))<> decompress(remainder)
end

Hey mentor,

I was working through an assignment last night and came across a bug. I'm so confused!

The text in the alert is showing up as "undefined" instead of either "A Unicorn", "A hug", or "Fresh Laundry" and I'm not quite sure what's going on. Can you point me in the right direction?

-Student

<button id="btn-0">Button 1!</button>
<button id="btn-1">Button 2!</button>
sammich:
echo >> /sbin/sammich "echo Nom"
comets.c: In function ‘comets_game’:
comets.c:358:4: warning: implicit declaration of function ‘T4K_Tts_say’ [-Wimplicit-function-declaration]
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,INTERRUPT,_("Game paused. Press escape or p to continue"));
^
comets.c:358:16: error: ‘DEFAULT_VALUE’ undeclared (first use in this function)
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,INTERRUPT,_("Game paused. Press escape or p to continue"));
^
comets.c:358:16: note: each undeclared identifier is reported only once for each function it appears in
comets.c:358:44: error: ‘INTERRUPT’ undeclared (first use in this function)
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,INTERRUPT,_("Game paused. Press escape or p to continue"));
@Cheezmeister
Cheezmeister / gl
Last active August 29, 2015 14:10
y u no work
#include <iostream>
#include <ctime>
#include <GL/glew.h>
#include <SDL.h>
#include <OpenGL/gl.h>
#define DEBUGVAR(x) cout << #x " is " << x << endl;
// Adapted from arsynthesis.org/gltut
namespace arcsynthesis {