Skip to content

Instantly share code, notes, and snippets.

@sirex
sirex / .gitignore
Last active December 1, 2016 06:44
VilniusPy 2015-06
/env
/default.style
/fonts
/*.pdf
/*.rst.build_temp
@sirex
sirex / main.py
Last active April 5, 2024 19:31
sqlalchemy joins with AS
import sqlalchemy as sa
import sqlparse
metadata = sa.MetaData()
tasks = sa.Table(
'tasks', metadata,
sa.Column('id', sa.Integer, primary_key=True),
sa.Column('bot', sa.String(255), nullable=False),
sa.Column('task', sa.String(255), nullable=False),
@sirex
sirex / main.py
Created May 21, 2015 08:42
Compare how two python packages are dependent
"""
Use snaekfood [1] to generate dot files:
$ sfood -i -u -f project/modulex project/moduley | sfood-graph -p > modulex-moduley.dot
[1] http://furius.ca/snakefood/
This will generate graph with blue, red and white circles.
If there are both blue and red circles it means, that
modulex and moduley depends on each another.
#!/usr/bin/env python3
import argparse
import re
import sys
import time
token_re = re.compile(r"[a-ząčęėįšųūž]+", re.IGNORECASE)
from sqlalchemy_utils import database_exists, create_database, drop_database
from sqlalchemy.dialects import postgresql, mysql, sqlite
from sqlalchemy import (
create_engine, select, func, and_, Column, Table, MetaData,
Integer, BigInteger, SmallInteger, LargeBinary,
)
BigInt = BigInteger()
BigInt = BigInt.with_variant(postgresql.BIGINT(), 'postgresql')
BigInt = BigInt.with_variant(mysql.BIGINT(), 'mysql')
@sirex
sirex / sauktinai.ipynb
Created May 13, 2015 08:45
Šauktinių duomenų statistinė analizė
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sirex
sirex / README.rst
Last active August 19, 2021 11:10
Append only storage

Install

sudo apt-get install mysql-server postgresql sudo apt-get build-dep python-mysqldb python-psycopg2 sudo -u postgres createuser -s sirex

pip install sqlalchemy sqlalchemy-utils mysql-python psycopg2 prettytable humanize

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sirex
sirex / pizza.py
Last active August 29, 2015 14:19
#!/usr/bin/env python3
import sys
import collections
import functools
import operator
def read(filename):
with open(filename, encoding='utf-8') as f:
:
`-- 1
|-- node 1.1
| `-- node 1.1.1
`-- node 1.2