Skip to content

Instantly share code, notes, and snippets.

@cxw42
cxw42 / apply-file
Last active Apr 13, 2020
Keyboard.io Model01 Colormap file
View apply-file
#!/bin/bash
# Modified from Model01-sketch/tools/colormap/apply by Gergely Nagy
# (algernon),
# https://github.com/algernon/Model01-sketch/blob/master/tools/colormap/apply ,
# licensed GPL3.
here="$(cd "$(dirname "$0")" &>/dev/null ; pwd)"
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <colormap filename>"
@cxw42
cxw42 / W.pm
Last active Jun 22, 2019
Investigating ${^WARNING_BITS} in Perl 5.26.2
View W.pm
package W;
#use Data::Dumper;
use strict;
use 5.014;
sub import {
say "Compile time: ", unpack('b*', ${^WARNING_BITS});
# ${^WARNING_BITS} is only available at compile time per
# https://www.perlmonks.org/?node_id=611472
}
@cxw42
cxw42 / cpanfile-from-Makefile-PL
Created May 29, 2019
Creating a cpanfile from dependency information in Makefile.PL
View cpanfile-from-Makefile-PL
#!perl
# Make a cpanfile from the dependencies in Makefile.PL.
# Modified from https://github.com/miyagawa/cpanfile/blob/master/README.md
# by miyagawa
use CPAN::Meta;
use Module::CPANfile;
die "Could not run Makefile.PL"
unless system($^X, 'Makefile.PL') == 0;
@cxw42
cxw42 / cd-to-git-root.sh
Created May 24, 2019
cd to the root of a git repo, even from .git or from submodules (bash)
View cd-to-git-root.sh
# Edit as noted below, then source this from your .bashrc, or paste it in there. Then
# cdgr
# will move you to the root of the current git repo (if any).
# If you are in a submodule, it will move you to the top of the containing repo.
# Edits:
# - If you are not on Cygwin, remove line 16
# - If you are on Cygwin, change YOUR_USERNAME on line 16 to ... your username ;) .
# This is to map from /cygdrive paths back to Cygwin-native paths.
@cxw42
cxw42 / mathlib.lua
Last active May 31, 2018 — forked from Xeoncross/mathlib.lua
Moved the exports into the `mathlib` package
View mathlib.lua
-- mathlib.lua
--[[
Maths extension library for use in Corona SDK by Matthew Webster.
All work derived from referenced sources.
twitter: @horacebury
blog: http://springboardpillow.blogspot.co.uk/2012/04/sample-code.html
code exchange: http://code.coronalabs.com/search/node/HoraceBury
github: https://gist.github.com/HoraceBury
@cxw42
cxw42 / test_3_45.t
Created Apr 3, 2018
Testing XML::Twig on Cygwin 64-bit
View test_3_45.t
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use XML::Twig;
use Test::More tests => 16;
is( XML::Twig->new( keep_encoding => 1)->parse( q{<d a='"foo'/>})->sprint, q{<d a="&quot;foo"/>}, "quote in att with keep_encoding");
You can’t perform that action at this time.