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/sh | |
| exec 2>&1 | |
| export PERL_PATH=/opt/perl-5.14/bin/perl | |
| exec $PERL_PATH /opt/perl-5.14/bin/growthforecast.pl --data-dir /home/growthforecast/growthforecast --port 80 -- \ | |
| setuidgid growthforecast |
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/sh | |
| exec 2>&1 | |
| exec /usr/bin/setuidgid growthforecast multilog t /etc/service/growthforecast/log/main |
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
| cmd_push() { | |
| parse_remote_name "$@" | |
| if [ -z "$REMOTE" ]; then | |
| REMOTE="$ORIGIN" | |
| fi | |
| name_or_current | |
| # sanity checks | |
| require_clean_working_tree | |
| require_branch "$BRANCH" |
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 -MConfig -e 'print $Config{archname}' |
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
| cpan -l 2>/dev/null | cut -f1 |
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
| test for daily coding |
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.010; | |
| use List::Util qw(sum); | |
| my $digit = 1; | |
| while (10**$digit <= 9**5*$digit) { ++$digit; }; | |
| say sum(grep { my $n = $_; $n eq sum(map { $_**5 } split(//, $n)) } 2..9**5*$digit); | |
| # => 443839 |
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.010; | |
| use Math::BigInt; | |
| my @list = map { my $b = $_; map { Math::BigInt->new($_) ** $b } 2..100 } 2..100; | |
| say scalar do { my %s; grep { !$s{$_}++ } @list }; # uniq | |
| # 9183 |
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.010; | |
| use List::Util qw(sum); | |
| my @maxs = map { $_ ** 2 } map { 2 * $_ - 1 } 1 .. 501; | |
| my $step = sub { my $i = shift; ($i + 1) * 2; }; | |
| say sum(map { $maxs[$_] * 4 + $step->($_) * 6 } 0 .. ($#maxs-1)) + $maxs[$#maxs]; | |
| # 669171001 |
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
| def d(n) | |
| t = (2..Math.sqrt(n).floor).select{|i| n % i == 0} | |
| ([1] + t + t.map{|i| n/i}).inject(:+) | |
| end | |
| amicable_num = (2...10000).select do |a| | |
| b = d(a) | |
| a == d(b) and a != b | |
| end | |
| puts amicable_num.inject(:+) |