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 PIL import Image | |
size = (36, 36) | |
image = Image.open(data) | |
image.thumbnail(size, Image.ANTIALIAS) | |
background = Image.new('RGBA', size, (255, 255, 255, 0)) | |
background.paste( | |
image, | |
((size[0] - image.size[0]) / 2, (size[1] - image.size[1]) / 2)) | |
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, sys, datetime | |
maxm = minm = None | |
for root, dirs, files in os.walk(sys.argv[1] if len(sys.argv) > 1 else '.'): | |
for name in files: | |
path = os.path.join(root, name) | |
mtime = os.path.getmtime(path) | |
maxm = maxm if maxm and maxm > mtime else mtime | |
minm = minm if minm and minm < mtime else mtime |
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
AppManager.module('${1:AppName}App', function (${1:AppName}App, AppManager, Backbone, Marionette, \$, _) { | |
'use strict' | |
var controllers = [ | |
createView: function () { | |
return new Marionette.ItemView({ | |
template: _.template('<p style="color:red">Empty content</p>'), | |
title: '${2:Неизвестный раздел}', | |
model: new Backbone.Model() |
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
# coding: utf-8 | |
import re | |
from xlrd import open_workbook | |
from xlwt import Workbook | |
def read_workbook(): | |
workbook = open_workbook('PriceObMatLidersb.xls') | |
for sheet in workbook.sheets(): |
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
# coding: utf-8 | |
import re | |
from collections import defaultdict | |
from json import dumps | |
from glob import glob | |
from os.path import basename, splitext, join | |
from lxml import etree | |
REFLAGS = re.IGNORECASE | re.UNICODE | re.MULTILINE |
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
package amq | |
import javax.jms.Session; | |
import org.apache.activemq.ActiveMQConnectionFactory; | |
import static amq.Constants.* | |
class Constants { | |
static final BROKER_URL = 'tcp://localhost:61616' | |
} |
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 time | |
from vec import Vec | |
from plotting import plot | |
def list2vec(l): | |
D = set(range(len(l))) | |
return Vec(D, {k: v for k, v in enumerate(l)}) | |
def draw_line(p1, p2): | |
resolution = 10 |
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
# upstart config /etc/init/kule.conf | |
description "Kule service for some-ui project" | |
author "Someone <[email protected]>" | |
start on runlevel [2345] | |
stop on runlevel [06] | |
respawn | |
exec python /home/admin/services/somekule.py |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>HDOut · iPhone Proxy</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
</head> | |
<body> | |
<a></a> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> |
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 sys | |
import logging | |
from math import ceil | |
from random import random | |
from datetime import datetime | |
from pymongo import ASCENDING | |
from pymongo.mongo_client import MongoClient | |
from pymongo.errors import OperationFailure |