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 v5.14; | |
use warnings; | |
use Time::Format qw(time_format); | |
use Time::ParseDate; | |
die <<END if $ARGV[0] && $ARGV[0] =~ m/-h(?:elp)?/; | |
$0: Fuzzy time conversion to localtime |
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
// Raw SVG: http://evemaps.dotlan.net/svg/Branch.dark.svg | |
function system(name,fn) { | |
document.getElementsByClassName('ss').each(function(elem){ | |
if(elem.textContent == name) fn.call(elem.parentElement) | |
}); | |
} | |
system('D4R-H7',function(){this.getElementsByClassName('s')[0].style.fill = '#000000'}); |
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 Data.List | |
import Data.Maybe | |
input x = map (\(a,b) -> (a, b * x)) | |
reduce :: [([Char], Integer)] -> [([Char], Integer)] | |
reduce = map (\(a,b) -> (head a, sum b)) . map (unzip) . group . sort | |
planet n = map (\(a,_) -> (n,a)) | |
planets_for = foldl1 | |
(\a b -> |
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 Data.List | |
import Data.Maybe | |
import Data.Monoid | |
-- The hard stuff | |
solve' :: Int -> [(Int, Int)] -> [(Int, Int)] -> Solutions | |
solve' nq queens board | |
| length queens == nq = Solutions [Solution nq queens] | |
| length board == 0 = mempty |
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 v5.14; | |
use warnings; | |
use LWP::UserAgent; | |
use List::MoreUtils qw(part); | |
use YAML qw(LoadFile); | |
use JSON::XS qw(decode_json); | |
use Text::FormatTable; |
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 v5.14; | |
use warnings; | |
package Handler::Send; | |
use base 'Tatsumaki::Handler'; | |
sub post { | |
my ($self,$id) = @_; |
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 v5.14; | |
use warnings; | |
use YAML::XS qw(Load); | |
my @files = qw(config.yml environments/development.yml); | |
unshift @files, @ARGV if @ARGV; | |
for (@files) { |
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
#ifdef STANDARD | |
#include <string.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#else | |
#include <my_global.h> | |
#include <my_sys.h> | |
#endif | |
#include <mysql.h> | |
#include <m_ctype.h> |
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
pascal' :: [Int] -> [Int] | |
pascal' l | |
| length l < 2 = [1] | |
| otherwise = (a + b) : (pascal' (b:rest)) | |
where a:(b:rest) = l | |
pascal :: [Int] -> [Int] | |
pascal = (1:) . pascal' |
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
npto :: (Integral a) => a -> [a] | |
npto x = [2,3] ++ concat [[x*6-1,x*6+1] | x <- [1..n]] | |
where n = ((+1) . round . sqrt . fromIntegral $ x) `div` 6 | |
factors :: (Integral a) => a -> [a] | |
factors 1 = [] | |
factors x = least : factors (x `div` least) | |
where least = head $ fs ++ [x] | |
fs = filter ((==0) . mod x) . npto $ x |
OlderNewer