Skip to content

Instantly share code, notes, and snippets.

View deontologician's full-sized avatar
🦀
🌎

Josh Kuhn deontologician

🦀
🌎
View GitHub Profile
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import *
Base = declarative_base()
class Access(Base):
__tablename__ = 'accesses'
access_id = Column(Integer, primary_key=True)
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.associationproxy import association_proxy
Base = declarative_base()
class Machine(Base):
__tablename__ = 'machines'
__table_args__ = {'sqlite_autoincrement': True}
@deontologician
deontologician / gist:7918366
Created December 11, 2013 20:59
webapp snippets
from tornado import web
from tornado import ioloop
from sqlalchemy.engine
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import os
class Tracker(Base):
__tablename__ = 'tracker'
id = Column(Integer, primary_key=True)
state = Column(String, nullable=False)
def __repr__(self):
return 'Tracker<{.id}>'.format(self)
from datetime import datetime, timedelta
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Version(Base):
@deontologician
deontologician / ipl.hs
Created February 7, 2014 01:47
Trying to prove (a > b) || (a < b) || (a == b)
{-# LANGUAGE TypeOperators, GADTs, StandaloneDeriving #-}
{-# OPTIONS_GHC -Wall #-}
import Prelude hiding(True, False, Bool, Eq)
data Z = Z
data S n = S n
data Nat n where
Zero :: Nat Z
@deontologician
deontologician / netezza_dialect.py
Last active August 29, 2015 13:57
Rough cut of a Netezza SQLAlchemy dialect. Mostly inherits from the Postgresql and PyODBC dialects.
Made an actual github repo for wiki/issues etc. Please see here:
https://github.com/deontologician/netezza_sqlalchemy
#![feature(macro_rules)]
extern crate libc;
use libc::{c_char, c_int, c_long};
#[link_name = "curses"]
extern {
fn setupterm (term: *c_char, fd: c_int, errret: *c_int) -> c_int;
fn tigetstr (s: *c_char) -> *c_char;
fn tparm (s: *c_char,
rustc --out-dir lib -L tmp src/term.rs && touch tmp/built
src/info/curses.rs:40:1: 40:12 error: macro definitions are not stable enough for use and are subject to change
src/info/curses.rs:40 macro_rules! def_escape(
^~~~~~~~~~~
src/info/curses.rs:40:1: 40:12 note: add #[feature(macro_rules)] to the crate attributes to enable
src/info/curses.rs:40 macro_rules! def_escape(
^~~~~~~~~~~
src/info/builtin.rs:711:1: 711:12 error: macro definitions are not stable enough for use and are subject to change
src/info/builtin.rs:711 macro_rules! def_escape(
^~~~~~~~~~~
fn main() {
let mut rows = [[ 1, 2, 3, 4],
[ 5, 6, 7, 8],
[ 9,10,11,12],
[13,14,15,16]];
for i in range(0, 4u) {
for j in range(0, 3u) {
/// Here's what I'd like to do