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 | |
| import subprocess | |
| from appy.pod.renderer import Renderer | |
| from time import time | |
| from pyramid.view import view_config | |
| from pyramid.response import ( | |
| Response, | |
| FileIter, | |
| ) | |
| from ..tools import get_settings |
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
| # http://python.web.id/angka-terbilang-pada-python/#.VQpS8s2sXQo | |
| satuan = ['', 'satu', 'dua', 'tiga', 'empat', 'lima', 'enam', 'tujuh', | |
| 'delapan', 'sembilan', 'sepuluh', 'sebelas'] | |
| def terbilang_(n): | |
| n = int(n) | |
| if n >= 0 and n <= 11: | |
| hasil = [satuan[n]] | |
| elif n >= 12 and n <= 19: |
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 -*- | |
| from sqlalchemy.sql.expression import asc, desc | |
| from sqlalchemy.sql import or_, and_ | |
| from sqlalchemy.orm.properties import RelationshipProperty | |
| from sqlalchemy.sql.expression import cast | |
| from sqlalchemy import String | |
| from collections import namedtuple | |
| ColumnTuple = namedtuple('ColumnDT', ['column_name', 'mData', 'search_like', 'filter']) |
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
| #!/usr/bin/python | |
| import sys | |
| import subprocess | |
| cmd = ['/usr/sbin/adduser'] + sys.argv[1:] | |
| subprocess.call(cmd) | |
| if sys.argv[1:]: | |
| username = sys.argv[1] |
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 sqlalchemy import ( | |
| Table, | |
| MetaData, | |
| ) | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy.orm import sessionmaker | |
| from sqlalchemy.schema import PrimaryKeyConstraint | |
| Base = declarative_base() |
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 string | |
| def clean(s): | |
| r = '' | |
| for ch in s: | |
| if ch not in string.printable: | |
| ch = ' ' | |
| r += ch | |
| return r |
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 sqlalchemy import create_engine | |
| db_url = 'oracle://user:pass@ip/db' | |
| engine = create_engine(db_url) | |
| sql = """INSERT INTO sync_sppt_ora2pg (kd_propinsi, kd_dati2, | |
| kd_kecamatan, kd_kelurahan, kd_blok, no_urut, kd_jns_op, | |
| thn_pajak_sppt, jns_sinkron) VALUES ('36','76','052', '004', | |
| '007', '3522', '0', '2014', '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
| from sqlalchemy import (create_engine, Column, Integer, String, ForeignKey, | |
| UniqueConstraint) | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy.orm import sessionmaker | |
| Base = declarative_base() | |
| class User(Base): |
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 | |
| import sys | |
| from optparse import OptionParser | |
| from sqlalchemy import create_engine | |
| from time import sleep | |
| import signal | |
| import commands | |
| import conf | |
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 sqlalchemy as sa | |
| import csv | |
| import sys | |
| tablename = sys.argv[1] | |
| filename = '%s.csv' % tablename | |
| url = 'postgresql://user:pass@host/dbname' | |
| eng = sa.create_engine(url) | |
| q = eng.execute("SELECT * FROM %s" % tablename) |