Skip to content

Instantly share code, notes, and snippets.

View manchicken's full-sized avatar
🦀
I pinch.

Mike Stemle manchicken

🦀
I pinch.
View GitHub Profile
✔ ~/Devel/perl6-posix-1 [refactoring|✚ 3]
22:45 $ perl6 --ll-exception -Ilib t/02-getuid.t
Could not find symbol '&DEFAULT'
at SETTING::src/core/Exception.pm:57 (/usr/local/Cellar/rakudo-star/2017.10/share/perl6/runtime/CORE.setting.moarvm:throw)
from SETTING::src/core/Failure.pm:44 (/usr/local/Cellar/rakudo-star/2017.10/share/perl6/runtime/CORE.setting.moarvm:throw)
from SETTING::src/core/Failure.pm:106 (/usr/local/Cellar/rakudo-star/2017.10/share/perl6/runtime/CORE.setting.moarvm:CALL-ME)
from gen/moar/BOOTSTRAP.nqp:3002 (/usr/local/Cellar/rakudo-star/2017.10/share/nqp/lib/Perl6/BOOTSTRAP.moarvm:)
from /Users/manchicken/Devel/perl6-posix-1/lib/POSIX.pm (POSIX):9 (/Users/manchicken/Devel/perl6-posix-1/lib/.precomp/272B80FC0A239CB25AC22453FE7B3B3434A80F34.1512853927.34594/23/23507E798D66FEE0B05313C2A15E15FF93E82F20:EXPORT)
from src/Perl6/World.nqp:880 (/usr/local/Cellar/rakudo-star/2017.10/share/nqp/lib/Perl6/World.moarvm:)
from src/Perl6/World.nqp:848 (/usr/local/Cellar/rakudo-star/2017.10/sh
@manchicken
manchicken / index.html
Created December 29, 2016 19:15
Inspecting Browser-Supplied MIME-Types
<form method="post" enctype="multipart/form-data" id="form" onSubmit="return runIt();">
<label for="fileInput">Select a File</label>
<input multiple="true" type="file" id="fileInput" name="fileInput" />
<input type="submit" name="submit" value="Check!" />
</form>
@manchicken
manchicken / rest-server-for-tests.js
Last active November 7, 2016 14:53
This is a simple HTTP server which gives you predictable HTTP responses based on the URL. It's super simple. This requires `lodash`.
'use strict'
const http = require('http')
const _ = require('lodash')
// Create an HTTP tunneling proxy
var svr = http.createServer( (req, res) => {
// Just some simple handler routines
const handlers = _.merge(
@manchicken
manchicken / simple-find-of-images.sh
Last active June 3, 2016 15:11
Simple command to find all of the images in a large directory tree
find ./public -type f | grep --line-buffered -i -E '\.(jpg|jpeg|bmp|gif|png)' | grep -v dojo
# OR
find -E ./public -type f -iregex '.*\.(jpg|jpeg|bmp|gif|png)' | grep -v dojo
# Compare the results of the two commands using MD5 sums:
find -E ./public -type f -iregex '.*\.(jpg|jpeg|bmp|gif|png)' | grep -v dojo | md5
# 65cc4b9df9eb6f99ecce0b5b1d209ecc
grep -aroP '.{0,20}XXXXX.{0,20}' {*.log,*.log-????????}
@manchicken
manchicken / Results.txt
Last active October 20, 2015 14:16
Inspired by https://gist.github.com/loganlinn/2165297, I want to see just `strtolower()` in an if though, and I wanted to see the results for larger values of `n`
mstemle@mstemle901:~/Desktop$ ./runtests.sh
String length: 512
************************
* if + strtolower *
************************
Time: 0.001159
Memory: 1904
************************
* strcasecmp *
************************
@manchicken
manchicken / named_capture.pl
Created January 17, 2014 04:26
This gist shows how to used named capture (along with anchors and /x) in regular expressions.
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use utf8;
use encoding 'utf8';
my $gbp = '£1.30';
my $usd = '$1.50';
@manchicken
manchicken / fork_play.pl
Created January 16, 2014 05:57
A quick demonstration of forking with blocking waits for when the children exit.
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use English;
for ( 0 .. 5 ) {
next if ( fork() > 0 ); # Remember, fork returns zero to the child, and the PID of the child to the parent.
identify_yourself(); # This sends the child process on its merry way.
@manchicken
manchicken / mock_module_fun.pl
Created October 28, 2013 02:20
Gist demonstrating Test::MockModule
#!/usr/bin/env perl
use strict;
use warnings;
use 5.014;
use DateTime;
use Test::More tests => 12;
use Test::MockModule;
# Fancy new package block syntax