This file contains 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
class maybe_delay(object): | |
""" | |
Will delay jobs if RQ is enabled. | |
""" | |
def __init__(self, func, call_directly=None): | |
self.func = func | |
self.call_directly = call_directly |
This file contains 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
#! /usr/bin/env python | |
import json | |
import os | |
import sys | |
import time | |
import urllib | |
import urllib2 | |
MASTER = "http://localhost:8000/beacons/" | |
RC_FILE = os.path.expanduser("~/.beaconrc") |
This file contains 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 tempfile | |
import barcode | |
import cups | |
import pdfkit | |
from barcode.writer import ImageWriter | |
def print_barcode(value): | |
printer_conn = cups.Connection() |
This file contains 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 factory | |
from django.test import TestCase | |
from y.models import Crap | |
def get_parent_tree(xid, relations, children=None, path=None): | |
""" | |
Reversed recursion. Goddamn it. | |
""" | |
# Get Current element, if possible |
This file contains 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
-module(etelegram). | |
-compile(export_all). | |
send_message(Token, Peer, Message) -> | |
post_request(Token, "sendMessage", | |
[{chat_id, Peer}, {text, list_to_binary(Message)}]). | |
get_users(Token) -> |
This file contains 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
def prefix_commit_message(repo, **kwargs): | |
commitctx = repo.commitctx | |
def rewrite_ctx(ctx, error): | |
branch_name = ctx.branch() | |
old_text = ctx._text | |
if branch_name not in old_text: | |
ctx._text = "{}: {}".format(branch_name, old_text) | |
return commitctx(ctx, error) |
This file contains 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
(add-to-list 'load-path "~/.emacs.d/emacs-for-python/") ;; tell where to load the various files | |
(add-to-list 'load-path "/usr/local/lib/erlang/lib/tools-2.6.15/emacs") | |
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/base16-emacs") | |
(load-file "~/.emacs.d/themes/base16-emacs/base16-default-theme.el") | |
(require 'epy-setup) ;; It will setup other loads, it is required! | |
(require 'epy-python) ;; If you want the python facilities [optional] | |
(require 'epy-completion) ;; If you want the autocompletion settings [optional] | |
(require 'epy-editing) ;; For configurations related to editing [optional] | |
(require 'epy-bindings) ;; For my suggested keybindings [optional] |
This file contains 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
-login2('GET', []) -> | |
+login2('GET', [], Context) -> | |
Form = boss_form:new(login_form, []), | |
- {ok, [{form, Form}, {redirect, Req:header(referer)}]}; | |
+ {ok, [{form, Form}, {redirect, Req:header(referer)} | Context]}; | |
-login2('POST', []) -> | |
+login2('POST', [], Context) -> | |
Form = boss_form:new(login_form, []), | |
case boss_form:validate(Form, Req:post_params()) of |
This file contains 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
filter_get_session_id(RequestContext) -> | |
%% Get session_id from requestContext or Cookies | |
case proplists:get_value(session_id, RequestContext) of | |
undefined -> | |
%% Try loading session_id from request, using boss_web_controller | |
boss_web_controller:generate_session_id(proplists:get_value(request, RequestContext)); | |
SessionID -> | |
SessionID | |
end. |
This file contains 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
(add-to-list 'load-path "~/lisp") | |
(add-to-list 'load-path "~/lisp/color-theme") | |
(add-to-list 'load-path "~/lisp/python-mode") | |
(add-to-list 'load-path "/usr/local/lib/erlang/lib/tools-2.6.11/emacs") | |
(require 'php-mode) | |
(require 'color-theme) | |
(eval-after-load "color-theme" | |
'(progn |
NewerOlder