Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl -w
#
# usage: find-dup <dir> [<dir>...]
#
use strict;
use File::Find;
use IO::File;
use Digest;
my $digest_method = "MD5";
#!/usr/bin/ruby1.8 -Ku
require "iconv"
GETA = [0x3013].pack("U")
def to_geta(encoding, str, alter = GETA)
cd = Iconv.new(encoding, "utf8")
chars = []
str.each_char do |char|
@pen
pen / cal_html.pl
Created April 30, 2011 20:52
html calendar
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use DateTime;
use Text::Xslate;
use Encode;
render_calendar(@ARGV); # cal_html.pl 5 2011
@pen
pen / calcdraworder.pl
Created May 12, 2011 09:15
描画順を計算
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
# 入力ファイルはこんなかんじで
# .......
# ...AA..
# ..BB...
# ..BBC..
@pen
pen / kickout
Created September 13, 2011 15:04
kickout a user
#!/bin/sh
LANG=C who -u | awk "\$1 == \"$1\" { print \$7 }" | xargs -r kill -9
@pen
pen / cal_html.pl
Created November 6, 2011 09:33
HTML calendar 2
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use Time::Piece;
use Text::Xslate;
use Encode;
render_calendar(@ARGV); # cal_html.pl 5 2011
@pen
pen / gist:3915913
Created October 19, 2012 02:25
sample style for Amon2 CRUD actions
package MyApp::PC::Admin::Member;
use 5.016;
use warnings;
my @RULE = (
name => ['NOT_NULL'],
);
sub edit {
my ($class, $c) = @_;
@pen
pen / moving-order.pl
Last active July 15, 2016 16:43
オフィス内の席替えで「現在の座席番号、移動先の座席番号、名前」のデータから待ったりパラレルに動いたりする段取りを計算
#!/usr/bin/env perl
use strict;
use warnings;
my %map; # 座席表
my @lines; # 順に移動する列を保持する
{
# データ読み込み
while (<DATA>) {
@pen
pen / shufle-members.gs
Created February 7, 2015 18:43
Google Spreadsheetで、名前付き範囲"members"の中の、空白でないセルの文字列をランダムに入れ替える。ランチ会の組み合わせを決めるとき等に。
function onclick() {
var lock = LockService.getDocumentLock();
if (lock.tryLock(10)) {
shuffle_members();
lock.releaseLock();
}
}
function shuffle_members() {
var range = SpreadsheetApp.getActiveSheet().getRange("members");
@pen
pen / list-my-groups.gs
Created February 20, 2015 03:26
Google App で自分が参加しているグループをGoogleスプレッドシートにとりだすGoogle App Script
/*
* @OnlyCurrentDoc
*/
function myFunction() {
var names = GroupsApp.getGroups()
.map(function(g) { return g.getEmail().replace(/@.*/, "") })
.sort();
SpreadsheetApp.getActiveSheet()