Refer to https://github.com/ap/bashrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: license [fullname] | |
# Prints an MIT license appropriate for totin' around. | |
# | |
# $ license > COPYING | |
# $ license 'Joe Random' > COPYING | |
#!/bin/sh | |
FULLNAME=${1:-$(getent passwd $(id -u) | cut -d: -f5 | cut -d, -f1)} | |
cat << "." | |
Copyright (c) `date +%Y` $FULLNAME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.006; | |
use strict; | |
use Irssi; | |
our $VERSION = '0.1'; | |
our %IRSSI = ( | |
authors => 'Nanuq', | |
contact => 'n/a', | |
name => 'quotepass', | |
description => q"gets around Undernet's silly /QUOTE PASS nonsense", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ cf.: | |
\ Algorithm: http://en.wikipedia.org/wiki/Exponentiation_by_squaring | |
\ Other examples: http://canonical.org/~kragen/sw/inexorable-misc/exponent.fs | |
variable the-exp | |
: do-exp ( x -- x^the-exp ) | |
>r | |
the-exp @ 0= if rdrop 1 exit then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use List::Util 'reduce'; | |
sub pascal { | |
my ( $x, @p, @q ) = shift; | |
push @p, reduce { push @p, $a + $b; $b } 1, @q = @p, @p = () for 1 .. $x - 1; | |
1, @p; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" defines a :Sudo command that works largely like :w | |
" but uses `sudo` to the file using root permissions | |
function! SudoWrite(file,line1,line2) | |
" intercept the external file change reload prompt event | |
autocmd FileChangedShell <buffer> : | |
" shazzam | |
exe 'silent' a:line1 . ',' . a:line2 . 'write !sudo tee 1>/dev/null' strlen(a:file) ? a:file : '%' | |
" force-trigger vim's file modification check, then undo the intercept | |
checktime | autocmd! FileChangedShell <buffer> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# you need this | |
alias gg='git grep -E' | |
# highlighted diff goodness is not just for git repos any more | |
alias diff='git diff --no-index' | |
# qf=quickfix | |
git config --global alias.qf 'commit --amend -C HEAD' | |
# Git Is My Refactoring IDE: edit all files that contain a particular pattern |
Steffen Winkler [email protected]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl | |
use Plack::Builder; | |
builder { | |
enable sub { | |
my $app = shift; | |
sub { | |
my $env = shift; | |
Plack::Util::response_cb( $app->( $env ), sub { | |
my @out = ( 'a' .. 'z' ); | |
sub { shift @out } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.014; | |
use strict; | |
use warnings; | |
use HTTP::Tiny (); | |
use JSON 'decode_json'; | |
sub get_dists_for_author { | |
my ( $author ) = @_; | |
my $url = sprintf 'http://api.metacpan.org/v0/release/_search?q=author:%s+AND+status:latest;fields=name;size=200', $author; |