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
" Change HTML of Yandex fotki album snippet. | |
" vim: set expandtab ts=4 sw=4 ai si ci: | |
function! FixYandexFotkiSnippet() | |
" remove cuts | |
s#<lj-cut><cut><!--more-->## | |
s#</cut></lj-cut>## | |
" remove wrapping links | |
s#</\?a[^>]*>##g | |
" remove hardcoded border, replace with CSS class | |
s#border="0"#class="whitebg"#g |
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
#!/bin/sh | |
# grep wrapper to look into PDF files | |
# supports -i, -c, -v options | |
# depends on pdftotext | |
# known bugs: | |
# FIXED 1. does not suppot spaces in the pattern | |
# 2. does not support grep -r | |
# WONTFIX 3. does not support grep -f (it is used to keep pattern) |
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
#!/bin/sed -f | |
# remove cuts | |
s|<lj-cut><cut><!--more-->|| | |
s|</cut></lj-cut>|| | |
# remove wrapping links | |
s|</\?a[^>]*>||g | |
# remove hardcoded border, replace with CSS class | |
s|border="0"|class="whitebg"|g | |
# separate by blank links |
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
\section{Programming in Octave} | |
Just like any other programming language, Octave has its loop and conditional | |
constructs. The following example demonstrates how to generate the first 10 | |
values of Fibonacci's sequence using a for loop: | |
<<Fibonacci sequence>>= | |
fib = [ 0, 1 ]; | |
for i = 3:10 | |
fib = [ fib, fib( i-2 ) + fib( i-1 ) ]; |
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 qualified Data.Array as A | |
import Control.Parallel.Strategies | |
ack 0 n = n+1 | |
ack m 0 = ack (m-1) 1 | |
ack m n = ack (m-1) (ack m (n-1)) | |
main = do | |
let arr = A.listArray (0,999) [1..] :: A.Array Int Int | |
let res = (fmap (ack 2) arr) `using` parTraversable rdeepseq |
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
%% This program is free software; you can redistribute it and/or | |
%% modify it under the terms of the GNU General Public License | |
%% as published by the Free Software Foundation; either version 2 | |
%% of the License, or (at your option) any later version. | |
%% | |
%% This program is distributed in the hope that it will be useful, | |
%% but WITHOUT ANY WARRANTY; without even the implied warranty of | |
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
%% GNU General Public License for more details. | |
%% |
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
from scipy.misc import imread, imsave | |
from scipy import mean, interp, ravel, array | |
from itertools import izip | |
import sys | |
def mkcurve(chan1,chan2): | |
"Calculate channel curve by averaging target values." | |
fst = lambda p: p[0] | |
snd = lambda p: p[1] | |
sums = {} |
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 runhaskell | |
A password generator inspired by XKCD #936: http://xkcd.com/936/ | |
Passwords which are easy for humans to remeber and hard for computers to guess. | |
> import Control.Monad (liftM, when) | |
> import Data.List (intercalate, isPrefixOf) | |
> import System.Random (getStdGen, randomRs) | |
> import System.Environment (getArgs) |
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
{-# LANGUAGE NoMonomorphismRestriction #-} | |
import Diagrams.Prelude | |
import Diagrams.Backend.Cairo.CmdLine | |
import Diagrams.TwoD.Util (width, height) | |
pentax_q = (6.16, 4.62) -- as 1/2.3" | |
oly_xz1 = (7.89, 5.81) -- http://j.mp/qfuFxT | |
nikon_cx = (13.2, 8.8) | |
four_thirds = (20.7, 13.8) |
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 python | |
from __future__ import with_statement | |
from cgi import escape | |
from os.path import expanduser | |
from string import Template | |
from sys import argv, version_info, exit | |
from xml.etree import ElementTree as ET | |
# import pickle | |
import warnings |