Skip to content

Instantly share code, notes, and snippets.

View frutik's full-sized avatar

Andrew Kornilov frutik

View GitHub Profile
[kyivstar_out]
exten => s,1,Set(CALLERID_ORIG=${CALLERID(num)})
exten => s,n,Set(CDR(userfield)=${DST_NUM})
exten => s,n,NoOp(${DIALEDPEERNUMBER})
exten => s,n,Log(WARNING, ${DST_NUM})
@frutik
frutik / check_postgres_replication.py
Created July 10, 2012 18:18 — forked from jacobian/check_postgres_replication.py
Nagios plugin to check PostgreSQL 9 streaming replication lag.
#!/usr/bin/env python
"""
Nagios plugin to check PostgreSQL 9 streaming replication lag.
Requires psycopg2 and nagiosplugin (both installable with pip/easy_install).
MIT licensed:
Copyright (c) 2010 Jacob Kaplan-Moss. All rights reserved.
@frutik
frutik / conver.py
Created July 19, 2012 13:47
How to create cyrillic pdf using python
import trml2pdf
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
enc = 'UTF-8'
pdfmetrics.registerFont(TTFont('DejaVuSans', 'DejaVuSans.ttf',enc))
pdfmetrics.registerFont(TTFont('DejaVuSans-Bold', 'DejaVuSans-Bold.ttf',enc))
from restoran.models import *
from django.contrib import admin
class DishIngredientInline(admin.StackedInline):
model = Dish.ingredients.through
extra = 1
def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
field = super(DishIngredientInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
from django.db import models
from django.db import models
import xworkflows
from django_xworkflows import models as dxmodels
class TransitionLog(dxmodels.BaseTransitionLog):
# This is where we'll store the modified object
root@easy-contacts:/tmp# bower install pathjs
root@easy-contacts:/tmp# bower list --map
{
"jquery": {
"source": {
"main": "components/jquery/jquery.js"
}
},
"pathjs": {
"source": {}
@frutik
frutik / gist:4976793
Created February 18, 2013 11:43
>> class Foo(object): ... def isShit(self): ... return True ... >>> foo = Foo() >>> print '..' if foo.isShit() else '.' ..
>> class Foo(object):
... def isShit(self):
... return True
...
>>> foo = Foo()
>>> print '..' if foo.isShit() else '.'
..
frutik@Andrews-Mac-mini ~/Downloads$ cat a.py
class A(object):
def a(self):
print 'I am a'
frutik@Andrews-Mac-mini ~/Downloads$ cat b.py
class A(object):
def a(self):
print 'not a'
vagrant@weekblad-cms:/tmp$ cat 1.php
<?
$a = '{"a":"een ge\u00efmproviseerde vergaderruimte"}';
var_dump($a, json_decode($a, true));
var Channel = function(url, connect_callback, disconnect_callback) {
var url = url;
var connect_callback = connect_callback || function() {};
var disconnect_callback = disconnect_callback || function() {};
var conn;
return {
connect: function() {
conn = new SockJS(url);
conn.onopen = function () {