Skip to content

Instantly share code, notes, and snippets.

View justinzane's full-sized avatar

Justin Zane Chudgar justinzane

View GitHub Profile
@justinzane
justinzane / gist:2571533
Created May 1, 2012 21:25
tastypie problem
#models.py
class StoreType(models.Model):
name = models.CharField(max_length=24, unique=True)
class Meta:
ordering = ["name"]
def __unicode__(self):
return ("%24s" % (self.name))
class Store(models.Model):
name = models.CharField(max_length=24)
@justinzane
justinzane / gist:3244305
Created August 3, 2012 04:18
from api.py
##### api.py
class UserResource(ModelResource):
def obj_create(self, bundle, request=None, **kwargs):
return super(UserResource, self).obj_create(bundle,
request,
user=request.user)
def apply_authorization_limits(self, request, object_list):
return object_list.filter(pk=request.user.pk)
@justinzane
justinzane / gist:3289905
Created August 7, 2012 22:11
Histogram from django models
##### Assessor.models #####
class Question(models.Model):
text = models.TextField()
explanation = models.TextField()
class Choice(models.Model):
text = models.TextField()
is_correct = models.BooleanField(default=False)
question = models.ForeignKey(Question)
@justinzane
justinzane / btrfsck_log
Last active December 12, 2015 06:48
"for_chris" btrfsck --repair
warning, bad space info total_bytes 2147483648 used 40783278080
warning, bad space info total_bytes 3221225472 used 61184372736
warning, bad space info total_bytes 2147483648 used 9766256640
warning, bad space info total_bytes 3221225472 used 11188957184
warning, bad space info total_bytes 4294967296 used 81585467392
warning, bad space info total_bytes 5368709120 used 101985861632
warning, bad space info total_bytes 6442450944 used 122386956288
warning, bad space info total_bytes 7516192768 used 142788050944
warning, bad space info total_bytes 8589934592 used 163189145600
warning, bad space info total_bytes 9663676416 used 183590240256
12:58:28 root@justin-4320s:/usr/local/bin/for-chris# cat btrfsck-patch2.log | egrep -v '^root' | egrep -v '^warning'
checking extents
marking 0 dirty
lookup first_block group not found for 4194304
btrfsck repair 619748 counted 207830056960 used
checking fs roots
enabling repair mode
found 207830056960 bytes used err is 0
total csum bytes: 0
total tree bytes: 625098752
@justinzane
justinzane / gist:5279867
Created March 31, 2013 07:23
max_rewind_wierdness
N: [lt-pulseaudio] daemon-conf.c: Detected that we are run from the build tree,
fixing search path.
E: [lt-pulseaudio] main.c: Failed to kill daemon: No such file or directory
E: [pulseaudio] main.c: Failed to kill daemon: No such process
N: [lt-pulseaudio] daemon-conf.c: Detected that we are run from the build tree,
fixing search path.
W: [lt-pulseaudio] pid.c: Stale PID file, overwriting.
W: [lt-pulseaudio] authkey.c: Failed to open cookie file '/home/justin/.config/p
ulse/cookie': No such file or directory
W: [lt-pulseaudio] authkey.c: Failed to load authorization key '/home/justin/.co
@justinzane
justinzane / pareto.py
Created September 7, 2013 19:14
Sample Pareto Generator
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 7 07:20:11 2013
@author: justin
"""
import numpy as np
from matplotlib import pyplot as pp
import random
@justinzane
justinzane / wesnoth_profile_build_output
Created September 14, 2013 22:18
profile build error
/usr/sbin/ccache g++ -o build/profile/game_preferences_display.o -c -std=c++0x -pthread -W -Wall -pg -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBDBUS -DHAVE_CONFIG_H -DHAVE_CXX0X -D_X11 -DWESNOTH_PREFIX='"/usr/local"' -I. -Isrc -I/usr/include -I/usr/include/SDL -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include src/game_preferences_display.cpp
/usr/sbin/ccache g++ -o build/profile/hotkey_preferences_display.o -c -std=c++0x -pthread -W -Wall -pg -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBDBUS -DHAVE_CONFIG_H -DHAVE_CXX0X -D_X11 -DWESNOTH_PREFIX='"/usr/local"' -I. -Isrc -I/usr/include -I/usr/include/SDL -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/dbus-1.0 -I/usr/lib/db
@justinzane
justinzane / winmgr.cpp
Created November 15, 2013 07:04
winmgr.cpp
void winmgr::listener_() {
Uint64 count = 0;
while (!(stop_listener_.load())) {
count++;
zmq::message_t req;
// Wait for next request from client
try {
zmqsock_.recv (&req);
} catch (zmq::error_t &e) {
fprintf(stderr, "Iter[%lu] ZMQ Error: %d : %s\n", count, e.num(), e.what());
@justinzane
justinzane / openvpn-sketch
Created March 5, 2014 20:10
OpenVPN Sketch
##########################
# OpenVPN Cloud Server #
# `jz-rs-01` #
# eth0 123.123.123.123 #
# eth1 192.168.3.0/24 #
##########################
| | | |
-------------- | | |
| | | |
####################### | | |