Skip to content

Instantly share code, notes, and snippets.

View maizy's full-sized avatar
🕊️
-

Nikita Kovalev maizy

🕊️
-
View GitHub Profile
@maizy
maizy / init.lua
Created February 19, 2021 09:19
Hammerspoon global search hotkey for Bitwarden
-- file: ~/.hammerspoon/init.lua
-- https://www.hammerspoon.org/
--
-- Bring Bitwarden to front and focus on search field
-- Required accessability to be enabled in Hammerspoon & System preferences
function launch_bitwarden_search()
hs.application.launchOrFocus("Bitwarden")
local app = hs.appfinder.appFromName("Bitwarden")
if (app ~= nil) then
local activated = app:activate(true)
@maizy
maizy / main.go
Created January 4, 2021 11:14
git interface & struct embedding
package main
import "fmt"
type Resulter interface {
GetResult() string
}
type DefaultResulter struct {
Resulter
@maizy
maizy / minetest-5.0.md
Created April 6, 2019 09:24
minetest 5.0 on macOS

minetest 5.0 on macOS

Based on homebrew formula

Build

Build dependencies:

brew install freetype gettext irrlicht jpeg libogg libvorbis luajit cmake

@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
import scala.annotation.tailrec
@tailrec
def nextStep(
iter: Iterator[Int], someAcc: List[Int]): (Stream[Int], Iterator[Int], List[Int]) = {
if (iter.hasNext) {
val i = iter.next()
// emulate some window function computation
val newAcc = (i / 2) :: someAcc
val windowValue = newAcc.sum
[info] +-com.typesafe.play:play-ahc-ws-standalone_2.11:1.0.0-M4 [S]
[info] | +-com.typesafe.play:cachecontrol_2.11:1.1.2 [S]
[info] | | +-joda-time:joda-time:2.7 (evicted by: 2.9.6)
[info] | | +-joda-time:joda-time:2.9.6
[info] | | +-org.joda:joda-convert:1.7
[info] | | +-org.scala-lang.modules:scala-parser-combinators_2.11:1.0.5 [S]
[info] | | +-org.slf4j:slf4j-api:1.7.22
[info] | |
[info] | +-com.typesafe.play:play-ws-standalone_2.11:1.0.0-M4 [S]
[info] | | +-com.typesafe.akka:akka-stream_2.11:2.4.14 [S]
#!/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"
# python 2.6, 2.7, ... 3.3 ...
def __a(p):
print('a ' + p)
class A(object):
def __b(self):
print('A.__b')
@maizy
maizy / buf_vs_join.py
Last active December 18, 2015 16:49
join str with cStringIO vs ''.join(); ipython -i buf_vs_join.py
# coding: utf-8
from cStringIO import StringIO
def test_buf(i):
buf = StringIO()
for v in i:
buf.write(v)
return buf.getvalue()
def test_join(i):
@maizy
maizy / query.py
Last active December 17, 2015 09:59
dict-like object for url query string building
# _*_ coding: utf-8 _*_
from copy import deepcopy
import json
from lxml import etree
from frontik import make_qs
class QueryStringDict(dict):
"""
dict-like object for url query string building.