Skip to content

Instantly share code, notes, and snippets.

View hatarist's full-sized avatar

Igor Hatarist hatarist

View GitHub Profile
@hatarist
hatarist / json_login_required_mixin.py
Last active August 29, 2015 14:25
Django: JSONLoginRequiredMixin
from django.core.exceptions import PermissionDenied
from django.utils.translation import ugettext as _
from django.views.generic import TemplateView
from braces.views import JSONResponseMixin, LoginRequiredMixin
class JSONLoginRequiredMixin(LoginRequiredMixin, JSONResponseMixin):
"""
@hatarist
hatarist / .zshrc
Last active December 31, 2015 17:39
(zsh) Colorize iTerm2 prompt when connecting to SSH servers
alias sww="iterm_bg_color 30 0 0; ssh web-production; iterm_bg_color 0 0 0"
alias swt="iterm_bg_color 0 20 20; ssh web-test; iterm_bg_color 0 0 0"
function iterm_bg_color() {
local tty=$(tty)
osascript -e "
tell application \"iTerm\"
repeat with theTerminal in terminals
tell theTerminal
try