Skip to content

Instantly share code, notes, and snippets.

Andrey Vlasovskikh vlasovskikh

Block or report user

Report or block vlasovskikh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vlasovskikh
vlasovskikh / tweetread.py
Created Jun 1, 2014
Actor-based CLI Twitter client example for using asyncio
View tweetread.py
# Copyright (c) 2014 Andrey Vlasovskikh
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@vlasovskikh
vlasovskikh / pday.erl
Created Sep 13, 2013
Programmers day in Erlang
View pday.erl
-module(pday).
-export([main/1, pday/1, ordinal_to_date/2, date_to_string/1]).
ordinal_to_date(Year, N) ->
{Month, Day} = submod(N, months(Year)),
{Year, Month + 1, Day}.
date_to_string({Year, Month, Day}) ->
View gist:5644014
// Is it possible to shorten collection->array conversion in Kotlin?
fun f(): Array<String> {
val xs = setOf("foo", "bar")
return xs.toArray(Array(xs.size, { "" }))
}
View ideavim-test-example.feature
Given the following buffer in the <Normal mode>:
"""
123<caret>456
123789
"""
When I type:
"""
cw, abc, <Esc>, hhj, .
"""
Then the buffer should contain:
@vlasovskikh
vlasovskikh / ObjectAlgebra.kt
Created Aug 10, 2012
Object algebra approach to the Expression problem in Kotlin
View ObjectAlgebra.kt
/**
* Object algebra approach to the Expression problem in Kotlin.
*
* See also <http://lambda-the-ultimate.org/node/4572>.
*/
// Cannot put this fun inside main() in Kotlin M2
fun exp2plus3<A>(f: IntAlg<A>): A = f.add(f.lit(2), f.lit(3))
fun main(args : Array<String>) {
@vlasovskikh
vlasovskikh / local.coffee
Created Jul 23, 2011
Local vars in CoffeeScript are nonlocal sometimes
View local.coffee
f = ->
x = 2
x = 1
> console.debug "x = #{ x }"
x = 1
> console.debug "f() = #{ f() }"
f() = 2
@vlasovskikh
vlasovskikh / iks.coffee
Created Jun 23, 2011
Combinatory logic in CoffeeScript, JavaScript, and Python
View iks.coffee
I = (x) -> x
S = (f) -> (g) -> (x) -> (f x) (g x)
K = (x) -> (y) -> x
@vlasovskikh
vlasovskikh / pacnew
Created Jun 7, 2011
See graphical diff between your old and .pacnew configs, delete .pacnew if needed
View pacnew
#!/usr/bin/env python
# Author: Andrey Vlasovskikh
# License: MIT
import sys
import os
import subprocess
def main():
@vlasovskikh
vlasovskikh / README.md
Created Feb 4, 2011
Funny GCC Warning for FP Programmers
View README.md

Funny GCC Warning for FP Programmers

(via [zakharov][1])

Consider the following program:

$ cat > tmp.c << EOF
> struct S {
>     int x;
@vlasovskikh
vlasovskikh / vp-googlevideo
Created Sep 1, 2010
Tool for watching Google Video hosted videos with mplayer
View vp-googlevideo
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2010 Andrey Vlasovskikh
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
You can’t perform that action at this time.