Skip to content

Instantly share code, notes, and snippets.

View kageurufu's full-sized avatar
🏠
Working from home

Frank Tackitt kageurufu

🏠
Working from home
View GitHub Profile
@kageurufu
kageurufu / bsearch.py
Created August 12, 2014 15:24
python bsearch for finding failing builds of the dolphin emulator for bug hunting
import requests
import subprocess
f = open("dolphin-list.txt", "r")
ALL_FILES = [l.strip() for l in f.readlines()]
SOURCE_URL = "https://dl.dolphin-emu.org/builds/"
len(ALL_FILES)
@kageurufu
kageurufu / report.py
Last active August 29, 2015 14:03
Simple data munging for outputting reports
import csv
from StringIO import StringIO
def rec_getattr(obj, attr, default=None):
"""Get object's attribute. May use dot notation.
>>> class C(object): pass
>>> a = C()
>>> a.b = C()
>>> a.b.c = 4
#!/bin/bash
PERCENTAGE=0
(
while [ $PERCENTAGE -le 100 ]; do
echo "$PERCENTAGE"
case $PERCENTAGE in
[1-9])
;;
@kageurufu
kageurufu / models.py
Last active June 6, 2021 07:37
PostgreSQL JSON Data Type support for SQLAlchemy, with Nested MutableDicts for data change notifications To use, simply include somewhere in your project, and import JSON Also, monkey-patches pg.ARRAY to be Mutable @zzzeek wanna tell me whats terrible about this?
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Integer, Column
from postgresql_json import JSON
Base = declarative_base()
class Document(Base):
id = Column(Integer(), primary_key=True)
data = Column(JSON)
#do whatever other work
@kageurufu
kageurufu / flask.py
Created October 3, 2013 17:42
Flask-WTF FieldLists with Dynamic Entries
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.wtf import Form
from flask.ext.babel import gettext
from wtforms import SelectField, TelField, TextField, FormField, Fieldlist, SubmitField
from wtforms.validators import Optional, Required
app = Flask(__name__)
db = SQLAlchemy(app)
@kageurufu
kageurufu / linkedlist.hh
Last active December 17, 2015 16:39
linkedlist
#ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include <iostream>
template <class T>
class linkedList {
struct node {
node* ptr;
T data;