This file contains 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 datetime import date | |
def bulan_depan(bulan, tahun): | |
if bulan == 12: | |
bulan_b = 1 | |
tahun_b = tahun + 1 | |
else: | |
bulan_b = bulan + 1 | |
tahun_b = tahun |
This file contains 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 datetime import date | |
def bulan_depan(bulan, tahun): | |
if bulan == 12: | |
bulan_b = 1 | |
tahun_b = tahun + 1 | |
else: | |
bulan_b = bulan + 1 | |
tahun_b = tahun |
This file contains 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
# Debian: apt-get install espeak | |
# Other OS: http://espeak.sourceforge.net/download.html | |
import sys | |
import commands | |
import subprocess | |
from time import sleep | |
from datetime import datetime | |
This file contains 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
# pip install xlrd | |
import sys | |
from xlrd import open_workbook | |
filename = sys.argv[1] | |
wb = open_workbook(filename) | |
sheet = wb.sheet_by_index(0) | |
for row in range(sheet.nrows): |
This file contains 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
def get_seq(controls, name): | |
start = False | |
key_value = ':'.join([name, 'sequence']) | |
r = [] | |
for key, value in controls: | |
if key == '__start__' and value == key_value: | |
start = True | |
continue | |
if key == '__end__' and value == key_value: | |
start = False |
This file contains 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 | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, String | |
from sqlalchemy.orm import sessionmaker | |
Base = declarative_base() | |
class User(Base): | |
__tablename__ = 'users' |
This file contains 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 commands | |
from glob import glob | |
SHOW_KEYS = ['bcdUSB', 'idVendor', 'idProduct'] | |
for bus in glob('/dev/bus/usb/*'): | |
vals = dict() | |
for dev in glob('{b}/*'.format(b=bus)): | |
cmd = 'lsusb -D {d}'.format(d=dev) |
This file contains 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
# Web admin modem 3Com ADSL Wifi | |
import socket | |
socket.setdefaulttimeout(30) | |
import urllib | |
import urllib2 | |
import sys | |
from sgmllib import SGMLParser | |
import os | |
import mechanize |
This file contains 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 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: |
NewerOlder