Skip to content

Instantly share code, notes, and snippets.

@vladimiroff
vladimiroff / magicmouse.conf
Created Jun 10, 2016
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.
View magicmouse.conf
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
View test_tictactoe.py
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()
View keybase.md

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 Aug 18, 2013
json_view and jsonp_view decorators for Django
View views.py
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 Dec 29, 2011 — forked from AndrewRadev/bundle_updater_for_vim
Handy shell script for keeping my bundles in vim up-to date
View bundle_updater_for_vim
cd $HOME/.vim/
git submodule sync
git submodule foreach --recursive "git checkout master; git pull origin master; echo"
@vladimiroff
vladimiroff / AdultsOnlyMiddleware.py
Created Dec 21, 2011
Django Middleware: Each user has to confirm that he is at least 18 years old
View AdultsOnlyMiddleware.py
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 Nov 4, 2011
Mappings for Vimium
View vimium.vim
" 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 Aug 11, 2011
Returns the value of given key in dict or... something like a dict
View hash.py
# -*- 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 Aug 5, 2011
Try to import django environment on each bpython2 call.
View pythonrc.py
'''
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
You can’t perform that action at this time.