This file contains 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/env perl | |
use warnings; | |
use strict; | |
my $line = "one,two, three, four , five "; | |
sub print_list { | |
printf "[%s]\n", join(', ', @_); | |
} |
This file contains 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
/* vim: ts=4 noet ai : | |
$Id: pwdcomposer.user.js 79 2006-09-08 07:44:01Z joe $ | |
CREDITS | |
======= | |
Inspired by Nick Wolff's bookmarklet "Generate Password" | |
http://angel.net/~nic/passwdlet.html | |
MD5 hash functions (c) Paul Johnston |
This file contains 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 | |
=head1 NAME | |
colorize.pl - adds colors to e.g. log files using ANSI escape codes | |
=head1 SYNOPSIS | |
colorize.pl LOGFILE | |
some_command | colorize.pl |
This file contains 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
(prefer-coding-system 'utf-8) | |
(set-default-coding-systems 'utf-8) | |
(set-terminal-coding-system 'utf-8) | |
(set-keyboard-coding-system 'utf-8) | |
(setq default-buffer-file-coding-system 'utf-8) | |
(if (eq window-system 'x) | |
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) | |
(if (eq system-type 'windows-nt) |
This file contains 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
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.Map; | |
// There's more than one way to do it | |
public class StaticInitialization { | |
private static final Map<String, String> MAP_ONE = new HashMap<String, String>() {{ | |
put("one", "1. first"); | |
}}; |
This file contains 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
; Move Windows by holding Alt and clicking (and holding) the left mouse button anywhere in the window. | |
; You'll need http://www.autohotkey.com to use this script | |
LAlt & LButton:: | |
CoordMode, Mouse ; Switch to screen/absolute coordinates. | |
MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin | |
WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin% | |
WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin% | |
if EWD_WinState = 0 ; Only if the window isn't maximized | |
SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it. |
This file contains 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/perl -I./lib.jar | |
use My::Hadoop::WordCount; | |
My::Hadoop::WordCount::Reducer->run(); |
This file contains 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/perl -I./lib.jar | |
use My::Hadoop::WordCount; | |
My::Hadoop::WordCount::Mapper->run(); |
This file contains 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
package My::Hadoop::WordCount; | |
use Any::Moose qw(Role); | |
sub map { | |
my ($self, $line) = @_; | |
$self->emit(lc $_ => 1) foreach split /[\s.,:;!?]+/, $line; | |
} | |
sub reduce { |
This file contains 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 warnings; | |
use strict; | |
my $current_word = ""; | |
my $current_count = 0; | |
while (<>) { | |
chomp; |