Skip to content

Instantly share code, notes, and snippets.

View thebookworm101's full-sized avatar

thebookworm101

View GitHub Profile
@thebookworm101
thebookworm101 / gist:7928391
Created December 12, 2013 14:03
This is what i did to get the ace editor working with sharejs @0.7
/*
Most stuff up here seemed to need no change the orginal unmodified may be found here:
https://github.com/share/ShareJS/blob/0.6/webclient/ace.js
ideally you should be able to use it thus:
sjs = new window.sharejs.Connection(sock);
var doc = sjs.get('users', 'blah ' + Math.random());
doc.attach_ace(editor); // editor here here is some ace editor object i.e: var editor = ace.edit("editor");
###############
## this is my simple tornado asynchttpclient that fetches files:
## trouble is its giving damaged pdf's on downdload, im using it
## with python 3.3.2, (with 2.7x i did not need to specify encoding
## but with python 3.3.2 i have to specify it, but still get corrupted
## file.
from tornado import ioloop, httpclient
def get_file(url):
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
'''
Base Daemon class that takes care of the start, stop, and forking of the processes.
Used to daemonize any Python script.
'''
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
Oct 17, 2012 - See https://github.com/medined/accumulo_stackscript for an even better script. Really ignore the stuff below. Go. Scoot.
Aug 28, 2012 - See http://affy.blogspot.com/2012/08/stackscript-for-accumulo-on-linode.html for a more concise method is configuring accumulo. I'll leave this gist unchanged for fans of history.
My goal was to get Accumulo running on a VirtualBox Ubuntu instance. I was successful using the following steps. If a line starts with $ then it is a command-line to execute. Note that you'll need to have sudo privilege. My username was 'ubuntu'. If you are using a different username, you'll need to change the process a little bit. I'll try to point out where.
https://issues.apache.org/jira/browse/ACCUMULO
##########
# Start a new VirtualBox instance using the Ubuntu 11.10
@thebookworm101
thebookworm101 / my integrity
Last active December 10, 2015 13:08
having access to last (if any) end_time in every new entry of a model.
################entering some data the first time to my form doesnt work, it gives this error:
IntegrityError at /job/add/article/
(1048, "Column 'author_id' cannot be null")
Request Method: POST
Request URL: http://localhost:8000/job/add/article/
Django Version: 1.4.3
@thebookworm101
thebookworm101 / formfile
Created January 2, 2013 19:50
error while saving a form
####### My form isnt getting saved because of this error: iv marked line 19 in the view is line 26 in this gist
TypeError at /job/add/article/
save() takes at least 2 arguments (1 given)
Request Method: POST
Request URL: http://localhost:8000/job/add/article/
Django Version: 1.4.3
Exception Type: TypeError
@thebookworm101
thebookworm101 / myview
Last active December 10, 2015 12:49
this is an error im getting in one of my views, and i dont get why.
#################im getting this type error from on of my views:
TypeError at /job/add/article/
must be type, not JobForm
Request Method: GET
Request URL: http://localhost:8000/job/add/article/
Django Version: 1.4.3
Exception Type: TypeError
@thebookworm101
thebookworm101 / url django
Created January 2, 2013 15:22
django url
## how would i make this url more robust?
url(r'^$',
'job.list_detail.object_list',
{
'queryset': Job.objects.all(), ## how do i make this robust? right now if the database is empty i get an error
},
name='job_slug_index'),
##here is the error:
class TimeLogForm(forms.ModelForm):
class Meta:
exclude = ['begin_sec']
model = TimeLog
def __init__(self, *args, **kw):
super(TimeLogForm).__init__(self, *args, **kw)
def save(self, *args, **kw):
instance = super(TimeLogForm, self).save(commit=False)