Skip to content

Instantly share code, notes, and snippets.

#!perl
use Test::More;
my %storage;
use constant SAMPLE_CONSTANT => defined eval { $storage{cache} = get_string('abcd') };
sub get_string {
my ( $str ) = @_;
return ":$str:";
@atoomic
atoomic / test-google-drive.pl
Created December 24, 2019 17:56
Net::Google::Drive::Simple
#!perl
use strict;
use warnings;
use feature 'say';
use Net::Google::Drive::Simple;
my $gd = Net::Google::Drive::Simple->new();

Keybase proof

I hereby claim:

  • I am atoomic on github.
  • I am atoomic (https://keybase.io/atoomic) on keybase.
  • I have a public key ASCVq4GX0RUzPgH8lBFIeXySjdro_x0ePooO2OEfifh2rwo

To claim this, I am signing this object:

@atoomic
atoomic / cpan2gh_authors.pl
Created June 11, 2019 16:47
cpan2gh search
#!env perl
use v5.20;
use feature qw(signatures say);
no warnings qw(experimental::signatures);
use Test::More;
use HTTP::Tiny;
#!/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
@atoomic
atoomic / slack-dark-mode.css
Created November 7, 2018 16:47
slack dark mode
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
@atoomic
atoomic / gist:368d44b838a034bbe8a4fec7210c0219
Created August 16, 2018 14:28
testml - make test failure on macOS
Test Summary Report
-------------------
test/050-object-type.tml (Wstat: 0 Tests: 9 Failed: 1)
Failed test: 9
Parse errors: No plan found in TAP output
test/090-catch-error.tml (Wstat: 0 Tests: 0 Failed: 0)
Parse errors: No plan found in TAP output
test/110-stdlib-tests.tml (Wstat: 0 Tests: 13 Failed: 0)
Parse errors: No plan found in TAP output
Files=18, Tests=114, 12 wallclock secs ( 0.09 usr 0.04 sys + 9.43 cusr 1.81 csys = 11.37 CPU)
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