Skip to content

Instantly share code, notes, and snippets.

be95f1843e23ae1487bdda67404b300f4297f8aeb8362e4eb99062979123f193
@vladimiroff
vladimiroff / magicmouse.conf
Created June 10, 2016 13:10
Apple's Magic Mouse works out of the box on linux (kernel/drivers/hid/hid-magicmouse.ko.gz). However, I wanted to edit the acceleration a bit. I'm not using this mouse for more than an year now, but still wouldn't like to lose this, because it took me some time to figure out how these acceleration variables work in X.
Section "InputClass"
Identifier "Apple Magic Mouse"
MatchIsPointer "yes"
MatchVendor "0x5ac"
MatchProduct "0x30d"
Driver "hid-magicmouse"
Option "AccelerationNumerator" "2"
Option "AccelerationDenominator" "1"
Option "AccelerationThreshold" "4"
EndSection
import unittest
from tictac import (
Board, IllegalMoveError, WrongTurnError,
IN_PROGRESS, X_WON, O_WON, DRAW)
class TestBoard(unittest.TestCase):
def setUp(self):
self.board = Board()

Keybase proof

I hereby claim:

  • I am vladimiroff on github.
  • I am vladimiroff (https://keybase.io/vladimiroff) on keybase.
  • I have a public key ASDiZtvWsZMPVl5WQVQn3JDIwrO7IudbBH-DAlG2Syopdwo

To claim this, I am signing this object:

@vladimiroff
vladimiroff / views.py
Created August 18, 2013 18:18
json_view and jsonp_view decorators for Django
import json
from django.http import HttpResponse
class JsonResponse(HttpResponse):
def __init__(self, content, status=None):
super(JsonResponse, self).__init__(json.dumps(content), status=status,
mimetype='application/json')
@vladimiroff
vladimiroff / bundle_updater_for_vim
Created December 29, 2011 22:13 — forked from AndrewRadev/bundle_updater_for_vim
Handy shell script for keeping my bundles in vim up-to date
cd $HOME/.vim/
git submodule sync
git submodule foreach --recursive "git checkout master; git pull origin master; echo"
@vladimiroff
vladimiroff / AdultsOnlyMiddleware.py
Created December 21, 2011 09:36
Django Middleware: Each user has to confirm that he is at least 18 years old
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.conf import settings
class AdultsOnlyMiddleware(object):
"""
Each user has to confirm that he is at least 18 years old
Note: No, I did not make this for some porn site.
"""
@vladimiroff
vladimiroff / vimium.vim
Created November 4, 2011 12:41
Mappings for Vimium
" Unmap these silly J,K
unmap J
unmap K
map <C-h> previousTab
map <C-l> nextTab
" Cyrillic shortcuts
map гг scrollToTop
map Г scrollToBottom
@vladimiroff
vladimiroff / hash.py
Created August 11, 2011 11:36
Returns the value of given key in dict or... something like a dict
# -*- coding: utf-8 -*-
from django import template
register = template.Library()
@register.filter
def hash(name, key):
'''
Returns the value of given key
in dict or... something like a dict
@vladimiroff
vladimiroff / pythonrc.py
Created August 5, 2011 09:41
Try to import django environment on each bpython2 call.
'''
Try to import django environment on each bpython2 call.
So if there is a Django project in current directory we could use
bpython instead of ipython with the `manage.py shell_plus` command,
or just with `bpython2`
TODO: Optimize this only for bpython calls.
'''
try:
from django.core.management import setup_environ