This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype plugin on | |
syntax on | |
set number | |
set backspace=2 | |
set smarttab | |
set autoindent | |
vnoremap . :norm.<CR> | |
vnoremap ä @ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from .settings import * | |
DEBUG = True | |
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' | |
STATIC_URL = '/static/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$('[scroll-to]').click(function(e) { | |
var scrollTarget = $(e.target).attr('scroll-to'); | |
var scrollToElement = document.getElementById(scrollTarget); | |
if (!scrollToElement) { | |
return; | |
} | |
e.preventDefault(); | |
var top = $(scrollToElement).offset().top - $('header.navbar').height(); | |
$('body, html').stop().animate({scrollTop: top}, 500); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 443 ssl; | |
server_name example.com; | |
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; | |
ssl_session_cache shared:SSL:1m; | |
ssl_session_timeout 5m; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
core.editor=vim | |
color.ui=true | |
color.diff.meta=blue black bold |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute pathogen#infect() | |
syntax on | |
set number | |
set smarttab | |
set autoindent | |
vnoremap . :norm.<CR> | |
vnoremap ä @ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/8529265/google-authenticator-implementation-in-python/8549884#8549884 | |
import hmac, base64, struct, hashlib, time | |
def get_hotp_token(secret, intervals_no): | |
key = base64.b32decode(secret, True) | |
msg = struct.pack(">Q", intervals_no) | |
h = hmac.new(key, msg, hashlib.sha1).digest() | |
o = ord(h[19]) & 15 # without ord in python3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
from fabric.api import cd, env, lcd, local, parallel, roles, run | |
from fabric.context_managers import settings | |
from fabric.contrib.console import confirm | |
from fabric.decorators import runs_once | |
env.use_ssh_config = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.factory('QueuePromise', function($q) { | |
var lastPromise = $q(function(success, error) { | |
success(); | |
}); | |
return function(f) { | |
var lPromise = lastPromise; | |
lastPromise = $q(function(success, error) { | |
lPromise['finally'](function() { | |
f().then(success, error); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis | |
import uwsgi | |
def application(env, start_response): | |
uwsgi.websocket_handshake(env['HTTP_SEC_WEBSOCKET_KEY'], env.get('HTTP_ORIGIN', '')) | |
r = redis.Redis() | |
p = r.pubsub(ignore_subscribe_messages=True) | |
p.subscribe('test') | |
for message in p.listen(): |