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
# Vivake Gupta ([email protected]) | |
# http://tartarus.org/martin/PorterStemmer/python.txt | |
def m(self): | |
n = 0 | |
i = self.k0 | |
while 1: | |
if i > self.j: | |
return n | |
if not self.cons(i): |
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
measure :: (String, String) -> Int | |
measure (_,ds) = | |
length $ filter (=='c') ds' | |
where ds' = dropWhile (=='c') [head a | a <- group ds] |
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
getstem :: String -> String -> String | |
getstem str sfx = take (length str - length sfx) str | |
swapsfx :: String -> String -> String -> String | |
swapsfx str sfx [] = take (length str - length sfx) str | |
swapsfx str sfx sfx' = take (length str - length sfx) str ++ sfx' | |
step1a :: (String, String) -> String | |
step1a (str,_) = swapsfx str (fst sfxs') (snd sfxs') | |
where sfxs' = head $ dropWhile (\ss -> not $ fst ss `isSuffixOf` str) sfxs |
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
{- | |
Step 2 | |
(m>0) ATIONAL -> ATE | |
... | |
(m>0) BILITI -> BLE | |
-} | |
step2 :: String -> String | |
step2 str = | |
if (not $ null sfxs') && (measure $ snd $ wordDesc $ stm (fst sfx)) > 0 | |
then swapsfx str (fst sfx) (snd sfx) |
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
{- | |
The MIT License (MIT) | |
Copyright (c) 2103 Matthew Smith [email protected] | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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
git clone git://github.com/ansible/ansible.git | |
cd ./ansible | |
sudo make install | |
sudo easy_install jinja2 | |
sudo easy_install pyyaml | |
sudo easy_install paramiko | |
source ./hacking/env-setup |
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
echo "<your server ip x.x.x.x>" > host.ini | |
ansible all -i host.ini -m ping -u root | |
# x.x.x.x | success >> { | |
# "changed": false, | |
# "ping": "pong" | |
# } |
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
# bootstrap.yml | |
--- | |
- hosts: newservers | |
vars: | |
- ubuntu_release: raring | |
- logwatch_email: <your email addy> | |
# crypted passwords, generated on a Linux box using: | |
# echo 'import crypt,getpass; print crypt.crypt(getpass.getpass(), "$6$YOURSALT")' | python - | |
- root_password: '' |
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
ansible-playbook -i hosts.ini bootstrap.yml --user root |
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
int fromPPQ15360TicksToSamples (int ticks, int tempo, int sampleRate) | |
{ | |
// ticks -> samples | |
// 3.9025 = 60000 (milliseconds / min) / 15360 (ticks per quarter note) | |
return (3.9025 * sampleRate * ticks) / (double)tempo; | |
} | |
int fromSamplesToPPQ15360Ticks (int sampleOffset, int tempo, int sampleRate) | |
{ | |
// samples -> ticks |