Goal: Connect to MSSQL using FreeTDS / ODBC in Python.
Host: Ubuntu 11.10 x86_64
Install:
sudo apt-get install freetds-dev freetds-bin unixodbc-dev tdsodbc
pip install pyodbc sqlalchemy
In /etc/odbcinst.ini:
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| # Author: [email protected] | |
| from __future__ import with_statement | |
| from optparse import OptionParser | |
| import os | |
| parser = OptionParser(version="new9 command v1.0 -- by [email protected]") | |
| parser.add_option("-p", "--install", |
Goal: Connect to MSSQL using FreeTDS / ODBC in Python.
Host: Ubuntu 11.10 x86_64
Install:
sudo apt-get install freetds-dev freetds-bin unixodbc-dev tdsodbc
pip install pyodbc sqlalchemy
In /etc/odbcinst.ini:
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
| # Step 1: Set priveleges | |
| $ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all | |
| Starting... | |
| Setting allow all users to YES. | |
| Setting all users privileges to 1073742079. | |
| Done. | |
| # Step 2: Allow VNC clients |
| # -*- coding: utf-8 -*- | |
| """ | |
| Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html | |
| Author: Ola Sitarska <[email protected]> | |
| Copyright: Licensed under the GPL-3 (http://www.gnu.org/licenses/gpl-3.0.html) | |
| This script requires python-epub-library: http://code.google.com/p/python-epub-builder/ | |
| """ |
| -module(barber). | |
| -export([run/2, barber/1, clients/1, simulator/2]). | |
| -define(CUT_DUTAION, 20). | |
| run(RoomSize, Duration) -> | |
| % create barber | |
| BPid = spawn(?MODULE, barber, [?CUT_DUTAION]), | |
| % run simulartor with barber PID | |
| SPid = spawn(?MODULE, simulator, [BPid, RoomSize]), |
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| "math/rand" | |
| ) | |
| const ( | |
| CUTTING_TIME = 20 |
| #include <tunables/global> | |
| /usr/bin/skype { | |
| #include <abstractions/base> | |
| #include <abstractions/user-tmp> | |
| #include <abstractions/audio> | |
| #include <abstractions/nameservice> | |
| #include <abstractions/ssl_certs> | |
| #include <abstractions/fonts> | |
| #include <abstractions/ibus> | |
| #include <abstractions/dbus> |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000