Skip to content

Instantly share code, notes, and snippets.

@utyf
utyf / gist:9e042e093e2049ca8255
Created June 29, 2015 15:01
Activate virtualenv from subdirectories
ve() {
DIR=`pwd`
while true; do
if [ -d "$DIR/ENV" ]; then
. $DIR/ENV/bin/activate
break
elif [ -d "$DIR/env" ]; then
. $DIR/env/bin/activate
break
else
@utyf
utyf / syllable.hs
Created June 2, 2012 10:09
Разбивка русских слов на слоги
module Main( main ) where
import System.Environment( getArgs )
import Data.List
main = do
args <- getArgs
putStrLn $ intercalate "-" $ syllables $ head args
@utyf
utyf / collatz.hs
Created June 1, 2012 08:51
Collatz chains
import Data.List (maximumBy)
import Data.Function (on)
chain :: Integer -> [Integer]
chain 1 = [1]
chain n
| even n = n:chain(n `div` 2)
| odd n = n:chain(3*n + 1)