Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
filter() {
grep o= | grep -Eo '>\+?\w+ \w+<' | tr -d '<+>' \
| sed -r 's/^(Олег|Виктория) (\w+)/\2 \1/'
}
cd /tmp
[ -f 61461.html ] || wget -q http://vorotylo.livejournal.com/61461.html
echo 'Нгуен Лонг'
@vvv
vvv / cv-vvv_101124.txt
Created November 23, 2010 22:37
cv-vvv_101124
[ This file was last modified on 24 November 2010. ]
Valery V. Vorotyntsev
Kiev, Ukraine
Phone: +380-<fifty>196-786<five>
Email/IM: valery.vv@gmail.com
WWW: http://github.com/vvv http://vorotylo.livejournal.com/
@vvv
vvv / pdf-2-to-1
Last active August 29, 2015 14:06
Convert PDF 2 sides per page to 1 side per page
#!/bin/bash
## SEE http://superuser.com/questions/54054/convert-pdf-2-sides-per-page-to-1-side-per-page
##
## Find out the size of a page (MediaBox). If you use Mac OS X's
## Preview app then select `Tools -> Show Inspector' in the menu or
## type `Cmd-I'.
MEDIA_BOX=612x792
INFILE=TYH.pdf
@vvv
vvv / gdb-m0ut-bt.sh
Last active August 29, 2015 14:25
gdb-m0ut-bt
#!/bin/sh
set -eu
M0UT=ut/.libs/lt-m0ut
[ -x $M0UT ] || { echo "$M0UT: No such file" >&2; exit 1; }
CORE=$(sudo ls -t $(sudo find /var/mero -type f -name core.\*) | head -1)
sudo gdb -nx -c $CORE $M0UT <<EOF
set pagination off
@vvv
vvv / noexit.sh
Last active August 29, 2015 14:27
Surprise of the day
$ cat noexit.sh
#!/bin/sh
seq 100 | while read; do exit; done # If `exit' terminated the script ..
echo 'Still alive!' # .. this message would not be printed.
$
$ sh noexit.sh
Still alive!
@vvv
vvv / Program.hs
Last active July 13, 2017 18:50
Working through the Operational Monad Tutorial
{-# LANGUAGE GADTs #-}
module Program where
--
-- The Operational Monad Tutorial:
-- http://apfelmus.nfshost.com/articles/operational-monad.html
--
-- GADT
data Program instr a where
Then :: instr a -> (a -> Program instr b) -> Program instr b
listsum :: Num a => [a] -> a
listsum [] = 0
listsum (x:xs) = x + listsum xs
main :: IO ()
main = print $ listsum [1..5]
@vvv
vvv / misc.hs
Last active August 24, 2017 16:50 — forked from mssawant/misc.hs
Haskell exercise
{-- XXX Your definition of `checkChar` is okay, but the abstraction itself
-- is very odd. It is fine as an exercise of using "do" notation and
-- `return`. In real code though explicit statements are both short and
-- expressive (see lines 21-22).
checkChar :: IO Bool
checkChar = do
c <- getChar
return (c == 'y')
--}
@vvv
vvv / OrdEq.hs
Created September 7, 2017 10:54 — forked from mssawant/ordeq.hs
import Data.Foldable (foldl')
import Debug.Trace (trace)
prnEqual :: (Eq a) => a -> a -> IO ()
prnEqual a b = if a == b then print "True" else print "False"
-- Note the absence of parentheses around `Eq a` and having exactly one `print`.
prnEqual' :: Eq a => a -> a -> IO ()
prnEqual' a b = print $ if a == b then "True" else "False"
@vvv
vvv / DaPhone.hs
Created December 2, 2017 00:02
The Phone exercise from Chapter 11 of the Haskell book
{-# OPTIONS_GHC -Wall -Werror #-}
module DaPhone where
import Data.Char (isUpper, toLower)
import Data.List (elemIndex, foldl', intersperse)
import Data.Maybe (catMaybes)
data DaPhone = DaPhone [String]
deriving (Eq, Show)