Skip to content

Instantly share code, notes, and snippets.

View ostronom's full-sized avatar

Konstantin Kirillov ostronom

View GitHub Profile
-------------------------------------------------------------------------------
-- xmonad.hs for xmonad-darcs
-- Author: Øyvind 'Mr.Elendig' Heggstad <mrelendig AT har-ikkje DOT net>
-------------------------------------------------------------------------------
-- Imports --
-- stuff
import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit
class YandexEncoder(object):
million = 10**6
points = []
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_='
def __init__(self, geom):
#self._encode(geom)
self.points = [
self.lift( (37.593578,55.735094) ),
self.lift( (37.592159,55.732469) ),
self.lift( (37.589374,55.734162) )
-E7gAANL5QKLVP__B2YAAM_w__-aBwAAhm3__7BIAAAh6P__PwMAAFls_v_T_f__4hj__yPb___QJP__6pj__7hK_v_u2P__KpD-_yo1AACu_f3_1wkBAAAAAABFEAAAqPv__yEOAABS9___2QoAACdc___higAAu7z__0sdAABqYP7_DrMAAC2c__8fGwAAhKD__-sLAACo-___bQUAAM-9__8GDQAA_PL__8YJAAArAgAAWREAAO8LAABLHQAA6v7__04QAAB_-f__Bg0AAJfU__83KQAAz73__x1OAAAN5___jRMAAPDY___ZCgAAzvD__6wIAAA89v__2QoAAH_5__8GDQAAje3__7IVAAD68v__DBoAALTi__-mIQAA-vL__wwaAAB_-f__MRwAALnv__-0CAAAje3__-b-__-04v__uu___3ns__-m-___bdL__5oHAADmvv__Zvj__-nL___NFgAAmtT__z8pAACN7f__fwYAAAvn__9zEgAADOf__4UTAACH4P__eR8AAD7D__-pYQAA0_3__4wgAADFCQAA8wsAAKr7___ZCgAAh63__zr2__9O6v__WQQAAArn__-GEwAAUvf__9kKAAD68v__DBoAAMvj__9gEQAAj8L__xILAADAKP__bfv__1Rd_v-bgwAAIur__4ejAAB9-f__tAgAAMzk_v-yuwAAXN7__40TAADJ2P3_kPkAAInV_f_o1gEAQgT__4esAAAd2___YBEAAG3S___rCwAAPir__0wdAACN7f__AAAAAGf4__-B-f__AAAAAAz0__9YBAAAQvb__2IeAABa3v__Zvj__1T3___88v__pvv__6Tu___t_v__ju3__yYCAAAH2_7__yUAAIng__-aBwAAG9v__1gRAADOS_7_wTsBAITU_v9lkAEAIbX__yOBAACxov__KtsAALmJ___5vgAAR93__0U2AAA89v__mgcAALrv__9SBAAA9n___4sgAAC1r___cxIAAKguAACOUgEA
{-# LANGUAGE OverloadedStrings, PackageImports #-}
module Hyphen (hyphenizeString) where
import qualified Text.Regex as R
hyphenizeString :: String -> String
hyphenizeString x = foldl subHyphen x (map compileRule rules)
where rus_v = "[аеёиоуыэюя]" :: String
rus_n = "[бвгджзклмнпрстфхцчшщ]" :: String
rus_x = "[йъь]" :: String
rus_a = "[абвгдеёжзийклмнопрстуфхцчшщъыьэюя]" ::String
import Text.Pandoc (WriterOptions, writerHtml5, writerWrapText, Pandoc, Inline(..), bottomUp)
import Hyphen (hyphenizeString)
hyphenize :: [Inline] -> [Inline]
hyphenize (Str x : xs) = (Str $ hyphenizeString x) : xs
hyphenize x = x
defaultPageCompiler = pageCompilerWithPandoc defaultHakyllParserState defaultWriterOptions (bottomUp hyphenize)
@ostronom
ostronom / CountryController.scala
Created February 20, 2012 17:00
Play 2.0 & squeryl simple integration
package controllers
import org.squeryl.PrimitiveTypeMode._
import org.squeryl.{Session}
import play.api._
import play.api.mvc._
import models._
# async calls sequentalization
apply = (f, s) -> () -> f( () -> s() )
id = (args...) -> args
foldr = (f, z, [x, xs...]) -> if x then f x, (foldr f, z, xs) else z
chain = (funcs...) -> (foldr apply, id, funcs)()
action1 = (done) ->
async_action_with_callback(done)
module V.Views {
export class View {
public someVar: any;
// the presence of constructor doesn't affect the error triggering
}
}
module V.App {
export class Application {
public registerView(url: string, viewKlass: V.Views.View): void
from datetime import date
import numpy as np
from scipy import polyval, polyfit
from django.utils.datastructures import SortedDict
days, values = np.array([
(date(2012, 4, 1).toordinal(), 45540),
(date(2012, 5, 1).toordinal(), 125598),
(date(2012, 6, 1).toordinal(), 195935),
(date(2012, 7, 1).toordinal(), 206702),
@ostronom
ostronom / Main.hs
Created August 22, 2013 10:04
hello-world wai-warp server
module Main where
import Network.Wai.Handler.Warp (run)
import qualified Routes as R
main = do
run 3000 R.routes