Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
use strict;
use warnings;
use v5.20;
use feature qw(signatures);
no warnings qw(experimental::signatures);
require Dumbbench; # use() causes breakage w/ perlcc.
@atoomic
atoomic / smartystring.c
Created December 11, 2018 16:54 — forked from bricef/smartystring.c
Dynamically growing a string in C.
#include <stdio.h>
#include <stdlib.h>
#define SMARTY_SIZE_INIT 16
typedef struct {
char * str; // a null terminated C string
char * end; // a pointer to the null byte, to be able to repeatedly append
// without using strlen() every time.
size_t size; // currently allocated size for *str, so we know when we
package Z;
use Devel::Peek ();
use overload "+"=>sub {42};
die "fail" unless 42 == bless({}) + 1;
Devel::Peek::Dump \%Z::;
use Inline C => <<END;
void foo(SV* targ) {
if (!SvOK(targ)) return;
if (SvROK(targ)) targ = SvRV(targ);

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@atoomic
atoomic / gist:1401524
Created November 28, 2011 18:57 — forked from schwern/gist:896004
Benchmarking simple accessors, Moose vs Mouse vs Moo vs hand written vs a hash
#!/usr/bin/env perl
use strict;
use warnings;
use Carp;
BEGIN {
# uncomment to test pure Perl Mouse
# $ENV{MOUSE_PUREPERL} = 1;