Skip to content

Instantly share code, notes, and snippets.

View dmalikov's full-sized avatar
🥞
!

Dmitry Malikov dmalikov

🥞
!
View GitHub Profile
@dmalikov
dmalikov / gist:4191299
Created December 2, 2012 22:14
liblastfm failed :[
> updateNowPlaying (Artist "Amenra") (Track "Némelèndèlle") Nothing Nothing Nothing Nothing Nothing Nothing ak sk s
Loading package tagged-0.4.4 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package bytestring-0.10.0.0 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package text-0.11.2.3 ... linking ... done.
Loading package attoparsec-0.10.2.0 ... linking ... done.
Loading package blaze-builder-0.3.1.0 ... linking ... done.
@dmalikov
dmalikov / px.hs
Created November 22, 2012 18:51
part of xmonad.hs
main :: IO ()
main = do
initCapturing
xmproc <- spawnPipe xmobar_run
xmonad $ defaultConfig
{ borderWidth = 7
, focusFollowsMouse = False
, focusedBorderColor = orangeDarkestColor
, keys = liftM2 union myKeys (keys defaultConfig)
, layoutHook = myLayoutHook
Data/Array/Repa/Algorithms/Matrix/Boolean.hs:28:3:
Couldn't match type `Array r3 ((Z :. Int) :. Int) e1'
with `CDL l => Array U DIM2 l'
Expected type: m (Matrix l)
Actual type: m (Array r3 ((Z :. Int) :. Int) e1)
In a stmt of a 'do' block:
computeP
$ fromFunction (Z :. h1 :. w2)
$ \ ix
-> joinAllS
@dmalikov
dmalikov / br.rb
Created November 7, 2012 18:37
INFINITE SYMBOL MADE OF COLONS
irb(main):014:0> class Symbol
irb(main):015:1> def append( x ) (self.to_s << x.to_s).to_sym end
irb(main):016:1> end
=> nil
irb(main):017:0> def us ( n ) Enumerator.new { |list| x = :":"; loop { x = x.append(:":"); list << x } }.take(n)[n-1] end
=> nil
irb(main):018:0> us(10000)
=> :":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@dmalikov
dmalikov / er
Created November 6, 2012 16:46
git wat
$> git pull --rebase origin master
usage: git merge-base [-a|--all] <commit> <commit>...
or: git merge-base [-a|--all] --octopus <commit>...
or: git merge-base --independent <commit>...
-a, --all output all common ancestors
--octopus find ancestors for a single n-way merge
--independent list revs not reachable from others
usage: git merge-base [-a|--all] <commit> <commit>...
@dmalikov
dmalikov / gist:4023181
Created November 6, 2012 07:08
cabal-dev ghci failed
$> cabal-dev ghci
cabal-dev: user error (Warning: cannot determine version of /usr/bin/fake-ghc-cabal-dev :
"== GHC Arguments: Start ==\n--numeric-version\n== GHC Arguments: End ==\n"
cabal: ghcInvocation: the programVersion must not be Nothing
)
@dmalikov
dmalikov / er.m
Created October 29, 2012 19:04
octave wat
octave:13> factorial 0
ans = 1.2414e+61
octave:14> factorial 1
ans = 6.0828e+62
octave:15> factorial 2
ans = 3.0414e+64
octave:16> factorial 10
ans =
6.0828e+62 1.2414e+61
@dmalikov
dmalikov / droowhile.hs
Created September 17, 2012 14:24
GREP PATTERN -A ∞
{-# LANGUAGE UnicodeSyntax #-}
import Control.Applicative ((<$>))
import System.Environment (getArgs)
import Text.Regex.Posix ((=~))
main ∷ IO ()
main = do
pattern ← head <$> getArgs
mapM_ putStrLn =<< dropWhile (\α → not $ α =~ pattern) . lines <$> getContents
@dmalikov
dmalikov / part01.rb
Created July 22, 2012 20:15
SAAS homework 1
def palindrome? (string)
filtered = string.downcase.gsub(/\W/,'')
filtered.reverse == filtered
end
def count_words (sentence)
words = sentence.downcase.split(/\W/)
result = {}
words.uniq.select{ |w| !w.empty? }.each do |e|
result.store(e, words.count(e))
@dmalikov
dmalikov / Graph.hs
Created July 11, 2012 11:56
Dijkstra shortest path algorithm (ADAA1 week 5)
{-# LANGUAGE UnicodeSyntax #-}
module Graph
( Distance, Graph, Vertex
, fromList, findShortestPath, findShortestPaths, findShortestPaths_
) where
import Control.Monad (when)
import Control.Monad.Reader (Reader, ask, runReader)
import Control.Monad.State (StateT, execStateT, get, put)
import Data.Function (on)