Skip to content

Instantly share code, notes, and snippets.

View astanin's full-sized avatar

Sergey Astanin astanin

View GitHub Profile
#!/usr/bin/env python2
# public domain
import csv
import json
import gzip
import re
import sys
import time
import urllib2
@astanin
astanin / writert.hs
Created September 3, 2012 13:35
A mini-tutorial on using WriterT monad transformer.
{- A mini-tutorial on using WriterT monad transformer. -}
import Control.Monad.Writer.Lazy
{- A single-argument IO action: print and return. -}
pr :: (Show a) => a -> IO a
pr x = do
print x
return x
#!/usr/bin/env python2
import scipy as sp
import matplotlib.pyplot as plt
SAMPLES=10000
BINS=50
xs = sp.linspace(-5,5,100)
fs = sp.randn(SAMPLES) # normally distributed samples
@astanin
astanin / imagej.sh
Created August 28, 2012 15:10
slightly less broken ImageJ launcher for Archlinux
#!/bin/bash
# imagej.sh - a not so simple wrapper script used to run ImageJ
# Copyright © 2008 Paolo Ariano
# Authors: Paolo Ariano (paolo dot ariano at unito dot it)
# Last modified date: 19 Sept 2008
# This is a not so simple wrapper script used to run ImageJ in Unix but
# optimized for Debian GNU/Linux, this is a merge between my original script
@astanin
astanin / PKGBUILD
Created August 28, 2012 15:01
fixed imagej PKGBUILD; clean-up some mess of the source distribution
# This PKGBUILD does not build the sources but rather
# downloads a precompiled jar from the project website.
#I trust the NIH is doing the right thing for us ;)
#I will hopefully create a PKGBUILD that really builds from sources in a future version
# Contributor: Giulio Guzzinati <skarn86junk@gmail.com>
pkgname=imagej
pkgver=145
pkgrel=2
pkgdesc="Image manipulation software for scientists"
@astanin
astanin / opencv_show_webcam_detect_face.py
Created July 12, 2012 12:36
OpenCV example. Show webcam image and detect face.
#!/usr/bin/env python2
"""
OpenCV example. Show webcam image and detect face.
"""
import cv2
TRAINSET = "/usr/share/OpenCV/lbpcascades/lbpcascade_frontalface.xml"
DOWNSCALE = 4
@astanin
astanin / mvector.clj
Created May 31, 2012 21:16
incanter.contrib.vecmath.mvector
(ns
^{:doc
"Implementation of vector products using DoubleMatrix1D from Parallel Colt"}
incanter.contrib.vecmath.mvector
(:use [incanter.core :only (matrix
ncol nrow dim
plus minus mult div
mmult trans)])
(:import [cern.colt.matrix.tdouble.algo SmpDoubleBlas]
[cern.colt.matrix.tdouble DoubleMatrix1D DoubleMatrix2D]
@astanin
astanin / naive.clj
Created May 31, 2012 15:46
incanter.contrib.vecmath.naive
(ns ^{:doc "Naive implementation of vector products."}
incanter.contrib.vecmath.naive
(:use [incanter.core :only (matrix mmult)]))
(defn dot
"Dot product between two vectors."
[u v]
(apply + (map * u v)))
(defn cross
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.4 U (http://www.xmlspy.com) by GribUser (Moscow) -->
<xs:schema targetNamespace="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:genre="http://www.gribuser.ru/xml/fictionbook/2.0/genres" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="FictionBookLinks.xsd"/>
<xs:import namespace="http://www.gribuser.ru/xml/fictionbook/2.0/genres" schemaLocation="FictionBookGenres.xsd"/>
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="FictionBookLang.xsd"/>
<xs:element name="FictionBook">
<xs:annotation>
<xs:documentation>Root element</xs:documentation>
</xs:annotation>
@astanin
astanin / PKGBUILD
Created March 30, 2012 09:41
rust-0.2 PKGBUILD
# Maintainer: Chris Bolton <chris@pixelgen.co>
pkgname=rust
pkgver=0.2
pkgrel=1
arch=('i686' 'x86_64')
pkgdesc='A safe, concurrent, practical language from Mozilla.'
url='http://www.rust-lang.org/'
license=('MIT')
depends=('gcc-libs')