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 / README.md
Created July 18, 2016 21:49 — forked from agnoster/README.md
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@harvimt
harvimt / Dockerfile
Created March 27, 2015 22:56
Docker inform7 builder
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y curl unionfs-fuse git
RUN curl -O -# http://inform7.com/download/content/6L38/gnome-inform7_6L38-0ubuntu1_amd64.deb
RUN dpkg -i --force-depends gnome-inform7_6L38-0ubuntu1_amd64.deb
RUN apt-get -yf install
RUN rm gnome-inform7_6L38-0ubuntu1_amd64.deb
RUN apt-get remove -y curl
@harvimt
harvimt / gist:2d4b4228b89ae472ed79
Created January 17, 2015 22:22
Quamash Mintest
import sys
from PyQt4.QtGui import *
import asyncio
from quamash import QEventLoop
class ClientController:
def __init__(self, server = None, loop=None):
self.server = server[0]
self.port = server[1]
self.loop = loop
@harvimt
harvimt / cffi_test.c
Created March 10, 2014 07:52
lib7zip minimal c example.
#include <stdio.h>
#include <windows.h>
#include <wchar.h>
#include <initguid.h>
#include "pstdint.h"
DEFINE_GUID(CLSID_CFormat7z,
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
DEFINE_GUID(IID_IInArchive,
@harvimt
harvimt / metastruct.py
Last active December 19, 2015 14:49
Example metaclass implementation for Python 3 for the construct3 library
class CustomCollection():
def __init__(self):
super().__init__()
self.items = []
def __setitem__(self, key, value):
if key == '_':
self.items.append(value)
else:
self.items.append((key, value))
@harvimt
harvimt / metaalchemy.py
Created May 6, 2013 16:42
Metaprogramming to get attributes for repr and update.
db_loc = 'sqlite:///%s\\data.sqlite' % store_loc
logging.info('db_loc=%s', db_loc)
engine = sqlalchemy.create_engine(db_loc, echo=False)
sess = scoped_session(sessionmaker(bind=engine))
class Base(object):
'''define basic object methods for debugging & initializing.'''
def __init__(self, *args, **kwargs):
>>> b = a = 'foo|bar'
>>> b = b.replace('|',' ')
>>> b
'foo bar'
>>> a
'foo|bar'
>>>
@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
@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 / 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')