Skip to content

Instantly share code, notes, and snippets.

View Copser's full-sized avatar
:octocat:
Something need doing?

p_pilipovic Copser

:octocat:
Something need doing?
View GitHub Profile

Sublime Text 2 – Useful Shortcuts (Ubuntu)

General

Ctrl+KB toggle side bar
Ctrl+Shift+P command palette
Ctrl+` python console
Ctrl+N new file

Editing

@Copser
Copser / gist:ed8af320be9c1437aa3c
Created November 5, 2014 06:23
IntegrityError
(venv)petarp@petarp-Aspire-5315:~/Documents/Projects/django_tutor_blog_ng/venv/django_tutorial_blog_ng$ python manage.py test blogengine
Creating test database for alias 'default'...
...................E.....
======================================================================
ERROR: test_clear_cache (blogengine.tests.PostViewTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/petarp/Documents/Projects/django_tutor_blog_ng/venv/django_tutorial_blog_ng/blogengine/tests.py", line 569, in test_clear_cache
post.save()
File "/home/petarp/Documents/Projects/django_tutor_blog_ng/venv/local/lib/python2.7/site-packages/django/db/models/base.py", line 545, in save
@Copser
Copser / AssertionError
Created November 15, 2014 06:09
Chapter 5: Saving User Input
petarp@petarp-Aspire-5315:~/Documents/TDD/superlists$ python3 functional_tests.py
F
======================================================================
FAIL: test_can_start_a_list_and_retrieve_it_later (__main__.NewVisitorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "functional_tests.py", line 45, in test_can_start_a_list_and_retrieve_it_later
self.check_for_row_in_list_table('1: Buy peacock feathers')
File "functional_tests.py", line 17, in check_for_row_in_list_table
self.assertIn(row_text, [row.text for row in rows])
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/petarp/.virtualenvs/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/petarp/.virtualenvs/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/home/petarp/.virtualenvs/env/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/petarp/.virtualenvs/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
@Copser
Copser / django-secret-keygen.py
Created June 15, 2016 18:25 — forked from mattseymour/django-secret-keygen.py
Django secret key generator
"""
Pseudo-random django secret key generator.
- Does print SECRET key to terminal which can be seen as unsafe.
"""
import string
import random
from __future__ import print_function
@Copser
Copser / messages.html
Created July 2, 2017 06:59 — forked from DmytroLitvinov/messages.html
[Django middleware for AJAX messages] Middleware for JSON responses. It adds to each JSON response array with messages from django.contrib.messages framework. It allows handle messages on a page with javascript. Django 1.10. #tags: django, python, ajax
<div id="messages">
{% for message in messages %}
<div {% if message.tags %}class="alert alert-dismissable alert-{{ message.tags }}"{% endif %}>
<a class="close" data-dismiss="alert" href="#">&times;</a>
{{ message }}
</div>
{% endfor %}
</div>

Keybase proof

I hereby claim:

  • I am copser on github.
  • I am copser (https://keybase.io/copser) on keybase.
  • I have a public key ASBvrQ4FvWfrXNGCVbuXGMPS7_MhPfyRKj0Ze17D1OHBBwo

To claim this, I am signing this object:

This file has been truncated, but you can view the full file.
INFO global: Vagrant version: 2.0.0
INFO global: Ruby version: 2.3.4
INFO global: RubyGems version: 2.5.2.1
INFO global: VAGRANT_OLD_ENV_DISPLAY=":0"
INFO global: VAGRANT_OLD_ENV_XDG_VTNR="2"
INFO global: VAGRANT_OLD_ENV_ZSH="/home/copser/.oh-my-zsh"
INFO global: VAGRANT_OLD_ENV_TEXTDOMAIN="im-config"
INFO global: VAGRANT_OLD_ENV_XMODIFIERS="@im=ibus"
INFO global: VAGRANT_OLD_ENV_LC_TELEPHONE="sr_RS"
INFO global: VAGRANT_OLD_ENV_XDG_RUNTIME_DIR="/run/user/1000"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
[2018-06-27 11:20:25,339: ERROR/MainProcess] Task save_messages_async[b1b360d6-c684-4501-92e2-195efd70099f] raised unexpected: MultipleObjectsReturned('get() returned more than one ConversationId -- it returned 2!',)
Traceback (most recent call last):
File "/srv/bspotted.net/venv/lib/python3.4/site-packages/celery/app/trace.py", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File "/srv/bspotted.net/venv/lib/python3.4/site-packages/celery/app/trace.py", line 438, in __protected_call__
return self.run(*args, **kwargs)
File "/srv/bspotted.net/app/inbox/tasks.py", line 33, in save_messages_async
save_messages_one(location.email)
File "/srv/bspotted.net/app/inbox/utils.py", line 111, in save_messages_one
conversation_parent = ConversationId.objects.get(conversation_id=message_id, email=page.email)