# requires ImageMagick
function img() {
identify -format '<img src="%f" width="%w" height="%h" />' $1
}
:%s/\%xa0/ /ge
:%s/\%u2019/'/ge
:%s/\%u201c/"/ge
:%s/\%u201d/"/ge
sage: R = PolynomialRing(QQ, 'x')
sage: f = R.lagrange_polynomial([(0,1),(2,2),(3,-2),(-4,9)]); f
-23/84*x^3 - 11/84*x^2 + 13/7*x + 1
/def key_pgdn = /dokey_hpage
/def key_pgup = /dokey_hpageback
/def -b'^J' = /dokey_line
/def -b'^K' = /dokey_lineback
;; ...
/def -PCred -F -t'fire'
/def -PCmagenta -F -t'#\d+'
#!/bin/bash
if [[ $# < 1 ]]; then
echo "cr: args pl0x" >&2
exit 1
fi
if g++ $1.cpp -O2 -Wall -o $1; then
echo "cr: compile OK" >&2
if [[ $# > 1 ]]; then
./$1 < $1-$2.in
else
./$1 < /dev/stdin
fi
fi
import Control.Applicative
import Control.Lens
import Control.Monad.Trans
import Control.Monad.Trans.State
import Control.Monad.Trans.Writer
import Data.Monoid
listTraversal :: Traversal' [a] a
listTraversal _ [] = pure []
listTraversal func (x:xs) = let newX = func x; newXs = listTraversal func xs in (:) <$> newX <*> newXs
getSeventh :: Int -> StateT Int (Writer (First Int)) Int
getSeventh = \a -> do
modify (+1)
i <- get
lift . tell . First $ if i == 7 then Just a else Nothing
return a
increaseSeventh :: Int -> State Int Int
increaseSeventh = \a -> do
modify (+1)
i <- get
return $ if i == 7 then a+1 else a
main = do
let x = [100,200..2000]
print $ execWriter (execStateT (listTraversal getSeventh x) 0)
print $ evalState (listTraversal increaseSeventh x) 0
on run {input, parameters}
tell application "Firefox" to activate
tell application "System Events"
keystroke "|"
delay 0.15
key code 125
key code 123
delay 0.15
keystroke "|"
delay 0.15
key code 125
key code 123
delay 0.15
keystroke "|"
delay 0.15
key code 125
key code 123
delay 0.15
keystroke "|"
delay 0.15
key code 125
key code 123
delay 0.15
keystroke "|"
delay 0.15
key code 125
key code 123
end tell
return input
end run