Skip to content

Instantly share code, notes, and snippets.

View maizy's full-sized avatar
🕊️
-

Nikita Kovalev maizy

🕊️
-
View GitHub Profile
@maizy
maizy / repl.md
Last active August 29, 2015 14:22
Как же передаются implicit параметры, почему не также как при карировании?

Как же передаются implicit параметры, почему не также как при карировании?

$ scala
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_31).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import scala.reflect.runtime.{universe => u}
import scala.reflect.runtime.{universe=>u}
@maizy
maizy / app.py
Created April 2, 2015 12:21
curl async client problems
# coding=utf-8
import httplib
import importlib
import logging
import re
import time
from lxml import etree
import tornado.autoreload
@maizy
maizy / result.html
Created January 29, 2015 15:57
xsl:param with nodeset
<html><body>
<h1>call 1</h1>
<div class="param1_content"><p><a href="http://example.com/">hello</a></p></div>
<h1>call 2 with param</h1>
<div class="param1_content">
oh no!
</div>
<h1>call 3 with param and value-of and apply-template</h1>
<div class="param1_content">
<b>Hello</b><b>world</b>
@maizy
maizy / start-ssh-tunnel.sh
Created December 4, 2014 06:45
fuck-rkn
#!/bin/bash
# Использование:
# start-ssh-tunnel.sh SSH-HOST
# где SSH-HOST - какой-нибудь SSH хост, где github доступен.
# Рекомендуется сначала сделать работу с этим хостом по ключам.
#
# После выполнения всех действий https://github.com/ должен будет заработать в браузерах.
# Для SSH доступа к github репозиториям возможно нужно будет использовать особый порт.
if [[ -z $1 ]]; then
@maizy
maizy / README.md
Last active August 29, 2015 14:08
python wide unicode

Поддержка unicode в python и проблема "wide" unicode

wide? wtf?

Unicode символы более U+FFFF (65535) называют "wide".

Вот полная таблица диапазонов unicode на данный момент:

name description range
# encoding: utf-8
def to_bin(x):
return ' '.join('{:08b}'.format(ord(i)) for i in x)
embeded_unicode = u'💩'
char_in_unicode = u'\U0001f4a9'
assert(embeded_unicode == char_in_unicode)
#!/bin/sh
# Author: Nikita Kovalev, https://gist.github.com/maizy/c4d31c1f539694f721f6
# Based on: https://gist.github.com/visenger/5496675
# Use java7 dependency (openjdk) instead of java6.
# Tested in Ubuntu 12.04.5 (precise)
SCALA="2.11.2"
SBT="0.13.5"
@maizy
maizy / json_reader_example.sc
Last active August 29, 2015 14:04
play framework scala: json readers example
// for `play console`
// enter to paste mode before by running `:paste`
import play.api.libs.json._
import play.api.libs.functional.syntax._
case class Account(name: String)
case class Repo(
name: String,
# _*_ coding: utf-8 _*_
from collections import OrderedDict
class LimitedDict(OrderedDict):
def __init__(self, limit):
super(LimitedDict, self).__init__()
self.limit = limit
var i = 7
def infStream(): Stream[Int] = i #:: infStream()
val stream = infStream()
println(stream.head)
// 7