Suggested abbrevation: getset
Applicable in Java
» Declaration
The live template:
/**
* Set $DESC$.
from __future__ import unicode_literals | |
import logging | |
from operator import methodcaller | |
import asyncio | |
from elasticsearch.exceptions import TransportError | |
from elasticsearch.helpers import BulkIndexError, expand_action, _chunk_actions | |
from elasticsearch.compat import map |
#!/usr/bin/env python | |
import os | |
import sys | |
import urllib2 | |
import json | |
''' | |
This script queries Github for source and target branches of a pull request | |
and updates environment variables at TeamCity CI to make these variable |
/opt/boxen/homebrew/bin/postgres -p 15432 -D /opt/boxen/data/postgresql -r /opt/boxen/log/postgresql/server.log |
Suggested abbrevation: getset
Applicable in Java
» Declaration
The live template:
/**
* Set $DESC$.
import asyncio | |
@asyncio.coroutine | |
def open_file(name): | |
print("opening {}".format(name)) | |
return open(name) | |
@asyncio.coroutine | |
def close_file(file): | |
print("closing {}".format(file.name)) |
""" | |
client.py - AsyncIO Server using StreamReader and StreamWriter | |
This will create 200 client connections to a server running server.py | |
It will handshake and run similar to this: | |
Server: HELLO | |
Client: WORLD |
# Simple: | |
# a --> b | |
# --> c --> d | |
# --> d | |
graph1 = { | |
"a": ["b", "c", "d"], | |
"b": [], | |
"c": ["d"], | |
"d": [] | |
} |
def rotate(matrix, n): | |
for layer in xrange(n/2): | |
first = layer | |
last = n - 1 - layer | |
for i in xrange(first, last): | |
offset = i - first | |
top = matrix[first][i] | |
# (0, 0) goes to (N-1, 0) | |
matrix[first][i] = matrix[last-offset][first] | |
# (0, N-1) goes to (0, 0) |
# -*- coding: utf-8 -*- | |
from django.contrib.auth.decorators import login_required | |
from django.utils.cache import patch_response_headers | |
from django.utils.decorators import method_decorator | |
from django.views.decorators.cache import cache_page, never_cache | |
from django.views.decorators.csrf import csrf_exempt | |
class NeverCacheMixin(object): | |
@method_decorator(never_cache) |