Skip to content

Instantly share code, notes, and snippets.

View softmoth's full-sized avatar

Tim Siegel softmoth

View GitHub Profile
var gistPrefix = 'https://gist.github.com/',
// Cache document.write so that it can be restored once all Gists have been
// embedded.
cachedWrite = document.write,
body = $('body'),
// Map each p.gist to an object that contains the paragraph to be replaced
// and the Gist's identifier.
gists = $('a.gist').map(function(n, a) {
a = $(a);
var href = a.attr('href');
@softmoth
softmoth / README.md
Last active July 6, 2023 07:51
Using a proxy to avoid tether throttling

Using a proxy to avoid tether throttling

I use used to use my mobile phone for internet access. My provider's Unlimited data plan discouragesd tethering (using the phone as a hotspot), though, by throttling traffic it sees coming from other devices.

A fairly simple and robust solution is was to run a proxy server on the phone, and then set up the router to send all traffic through the proxy.

Bit rot warning

@softmoth
softmoth / README.adoc
Last active July 20, 2018 07:40
zsh-prompt-newt preview
Note
This gist holds screenshots for my ZSH prompt theme, newt.
@softmoth
softmoth / README.md
Last active December 12, 2017 00:59
invalid typename or unknown type when nested under builtin type hierarchy

Save make-testcase.sh in /tmp, and:

rm -rf ./invalid-typename-bug; sh make-testcase.sh && \
    PERL6LIB=invalid-typename-bug/lib perl6 invalid-typename-bug/t.pl

If type=role, then the error is:

===SORRY!=== Error while compiling /tmp/invalid-typename-bug/lib/Bar.pm (Bar)
Invalid typename 'Baggy::Foo::TypeB'
sub MAIN() {
::('X::Y::Z').wut();
}
unit class X::Y::Z;
method wut() { hi() }
sub hi() is export { say "hi" }
@softmoth
softmoth / +WRT-Router.md
Last active February 19, 2019 05:25
OpenWRT upgrade; usb tether, ntfs3g samba
@softmoth
softmoth / gist:99ec805b291f10307aef62904b562bed
Created September 29, 2017 00:12
Results of `.parse()` as an async Seq?
grammar G {
token TOP { <a-line>* }
token a-line { (\V*) \n }
}
class A {
method TOP($/) {
note "!TOP ", $/<a-line>».made.perl, $/;
}
method a-line($/) {
@softmoth
softmoth / gist:e63b4920d89970620bcd96d4ce065420
Created September 25, 2017 22:58
match within action method?
#! /usr/bin/env perl6
grammar G {
rule TOP { <hi>+ %% <.line-end> }
token hi { hi }
token line-end { \n }
}
class A {
method TOP ($/) {
@softmoth
softmoth / gist:ab46fc0233d1981ec47d130c726a2224
Created September 25, 2017 18:13
YAMLish allow blank lines with less indentation
--- a/lib/YAMLish.pm6
+++ b/lib/YAMLish.pm6
@@ -223,7 +223,7 @@ grammar Grammar {
<.comment>? <.line-break>
:my $new-indent;
<?before $indent $<sp>=' '+ { $new-indent = $indent ~ $<sp> }>
- [ $new-indent $<content>=[ \N* ] | $indent <.before <.line-break> > ]+ % <.line-break>
+ [ $new-indent $<content>=[ \N* ] | ' ' ** { 0 .. $indent.chars } <.before <.line-break> > ]+ % <.line-break>
}
@softmoth
softmoth / gist:5a3e34b041cfe7ba045503c7d86f617b
Created September 24, 2017 20:00
YAMLish failure `foo: no good` doesn't parse
#! /usr/bin/env perl6
grammar Grammar {
rule TOP { <element> }
token plain { \N* }
token inline { yes | no }
token element {
<value=inline> || <value=plain>
}
}