Skip to content

Instantly share code, notes, and snippets.

View harvimt's full-sized avatar

Mark Harviston harvimt

  • Oracle
  • Seattle, WA
View GitHub Profile
@harvimt
harvimt / euler_p2_fp.hs
Created May 22, 2011 23:07
Project Euler Problem 2 in Haskell Recursive Implementation and List Comprehensions, In Python Imperitive implementation
--Haskell using recursion
problem2_fp = fibblte_h 4000000 1 1 0
where fibblte_h x y z s
| y + z >= x = ns
| otherwise = fibblte_h x z (y + z) ns
where ns
| even (y + z) = s + y + z
| otherwise = s
@harvimt
harvimt / PKGBUILD
Created August 30, 2011 00:20
PKGBUILD for haskell-hxt-tagsoup
# Maintainer: Arch Haskell Team <arch-haskell@haskell.org>
_hkgname=hxt-tagsoup
pkgname=haskell-hxt-tagsoup
pkgver=9.1.0
pkgrel=1
pkgdesc="TagSoup parser for HXT"
url="http://hackage.haskell.org/package/${_hkgname}"
license=('custom:OtherLicense')
arch=('i686' 'x86_64')
makedepends=()
@harvimt
harvimt / PKGBUILD
Created August 30, 2011 00:46
PKGBUILD for haskell-hxt-xpath
# Maintainer: Arch Haskell Team <arch-haskell@haskell.org>
_hkgname=hxt-xpath
pkgname=haskell-hxt-xpath
pkgver=9.1.1
pkgrel=1
pkgdesc="The XPath modules for HXT."
url="http://hackage.haskell.org/package/${_hkgname}"
license=('custom:OtherLicense')
arch=('i686' 'x86_64')
makedepends=()
@harvimt
harvimt / quotes.txt
Last active April 30, 2017 11:10
Quotes
“I’ve just got to say one thing: If this is it, if this is really the end—I get to use a rocket launcher.”
—Winston, Human Target (2010) S02E07
~~
“Behind the velvet lies / There is a truth as hard as steel.”
—“Holy Diver” by Dio
~~
@harvimt
harvimt / gist:1625368
Created January 17, 2012 07:07
Euler Problem 69
phi :: Int -> Int
phi n = length [ k | k <- [1..n], (gcd n k) == 1 ]
-- problem69_h :: Int -> Float -> Int -> Int
problem69_h cur_n max_phi max_n
| cur_n < 0 = max_n
| otherwise =
let cur_phi = (fromIntegral cur_n) / ( fromIntegral $ phi cur_n) in
if cur_phi > max_phi
then problem69_h (cur_n - 1) cur_phi cur_n
@harvimt
harvimt / allinone.py
Created March 2, 2012 02:29
Boilerplate Complaint
from sqlalchemy import create_engine, Column, Integer, String
engine = create_engine('sqlite:///data.db')
from sqlalchemy.orm import sessionmaker
Session = sessionmaker(bind=engine)
sess = Session()
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
@harvimt
harvimt / PKGBUILD
Created April 2, 2012 03:20
PKGBUILD for unarchiver
# Maintainer: Cedric Girard <girard.cedric@gmail.com>
# Contributor: N30N <archlinux@alunamation.com>
pkgname=unarchiver
pkgver=3.1.0
pkgrel=1
pkgdesc="An Objective-C application for uncompressing archive files"
arch=('x86_64' 'i686')
url="http://wakaba.c3.cx/s/apps/unarchiver.html"
license=('LGPL2.1')
@harvimt
harvimt / PKGBUILD
Created November 7, 2012 20:53
PKGBUILD & systemd .service file for razercfg-tool-git
# Maintainer: Jedipottsy
# Contributer: Mark Harviston <infinull@gmail.com>
pkgname=razercfg-tool-git
pkgrel=1
pkgver=20121107
pkgdesc="The next generation Razer device configuration tool."
arch=(i686 x86_64)
url="http://dual.bues.ch/cms/hacking/razercfg.html"
license=('GPL')
@harvimt
harvimt / PKGBUILD
Created December 10, 2012 13:04
PKGBUILD for lib7zip
_pkg=p7zip
_ver=9.20.1
pkgname=lib7zip
pkgver=1.6.3
pkgrel=2
pkgdesc="A library using 7z.dll/7z.so(from 7-Zip) to handle different archive types."
arch=(i686 x86_64)
url="http://code.google.com/p/lib7zip/"
license=('MPL')
source=("http://lib7zip.googlecode.com/files/$pkgname-$pkgver.tar.gz"
@harvimt
harvimt / alchemical_model.py
Created February 2, 2013 20:41
SQLAlchemy to/from PyQt Adapters
#!/usr/bin/env python2
#-*- coding=utf-8 -*-
# © 2013 Mark Harviston, BSD License
from __future__ import absolute_import, unicode_literals, print_function
"""
Qt data models that bind to SQLAlchemy queries
"""
from PyQt4 import QtGui
from PyQt4.QtCore import QAbstractTableModel, QVariant, Qt
import logging # noqa