Skip to content

Instantly share code, notes, and snippets.

View ssbb's full-sized avatar
🏠
Working from home

Sviatoslav Bulbakha ssbb

🏠
Working from home
View GitHub Profile
def build(self):
rows = []
def force_number(val):
try:
return float(val)
except:
return 0
users = WaterUser.objects.values(
@ssbb
ssbb / 0_README.md
Last active August 29, 2015 14:04
Automatically create Django environment on server.

Usage

./start_env.sh example.com

DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'dinvio',
'USER': 'dinvio',
'PASSWORD': '',
},
}
@ssbb
ssbb / *.txt
Created November 9, 2014 00:07
{
"waybill": null,
"updated_at": "2014-11-09T02:23:23.146221",
"turnover": "0.00",
"tariff": null,
"status": "new",
"sender_phone": "79198558244",
"sender": {
"name": "\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c",
"id": 1
@property
def service(self):
return self.company.code
for package in my_packages:
if (package.heigth > greater_package.heigth and
package.width > greater_package.width and
package.length > greater_package.length):
return package.bin
mapped_items = [{
'p_sum': i.get('price', None),
'p_dimensions': i.get('dimensions', []),
'p_weight': i.get('weight'),
'p_quantity': i.get('quantity'),
'p_valuable': i.get('valuable', False),
} for i in items]
0b0fda55c87274f069f93683dc61e51d2bba8801
Author: Alex Kir <alex@wall-dev.org>
Date: Mon Nov 17 11:29:50 2014 +0200
Modules update
* Swapped json to simplejson to get decimal encoding/decoding
* Updated requirements with suds-jurko instead of suds
* Updated requirements with simplejson
2 files changed, 3 insertions(+), 3 deletions(-)
function prompt_sorin_pwd {
local pwd="${PWD/#$HOME/~}"
if [[ "$pwd" == (#m)[/~] ]]; then
_prompt_sorin_pwd="$MATCH"
unset MATCH
else
_prompt_sorin_pwd="${${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}//\%/%%}/${${pwd:t}//\%/%%}"
fi
}
#
# A simple theme that displays relevant, contextual information.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Screenshots:
# http://i.imgur.com/nBEEZ.png
#