Skip to content

Instantly share code, notes, and snippets.

View ChillarAnand's full-sized avatar

Pandikunta Anand Reddy ChillarAnand

View GitHub Profile
@ChillarAnand
ChillarAnand / expand.html
Last active August 29, 2015 14:19
web-mode-indent
{% block js %}
<script>
(function(){
$( '.filter' ).parent().append(glyphicon);
$( '#filter-data' ).click(function() {
$( "#sidebar" ).toggle( "blind", {direction: 'left'} );
@ChillarAnand
ChillarAnand / 1.py
Created April 14, 2015 14:28
django gotchas #2
from django.db import models
class SimpleModel(models.Model):
name = models.CharField(max_length=100)
@ChillarAnand
ChillarAnand / ipy1.py
Created March 28, 2015 05:52
ipython tips tricks
In [1]: 1 + 2
Out[1]: 3
In [2]: 2 + 3
Out[2]: 5
In [3]: _ + 1
Out[3]: 6
In [4]: _
@ChillarAnand
ChillarAnand / 1.py
Last active August 29, 2015 14:17
a slice of python
In [118]: alpha
Out[118]: ['a', 'b', 'c', 'd', 'e', 'f']
In [119]: alpha[20]
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-119-c5b145def39d> in <module>()
----> 1 alpha[20]
IndexError: list index out of range
sudo aptitude install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libpulse-dev libxt-dev
@ChillarAnand
ChillarAnand / form.py
Last active August 29, 2015 14:17
django gotcha #1
In [1]: from django import forms
In [2]: class SampleForm(forms.Form):
...: name = forms.CharField(max_length=10, initial='avil page')
...:
In [3]: f = SampleForm()
In [4]: f.as_p()
Out[4]: u'<p>Name: <input maxlength="10" name="name" type="text" value="avil page" /></p>'
@ChillarAnand
ChillarAnand / celery periodic task example
Created November 22, 2014 08:53
celery periodic task example
from datetime import timedelta
from celery import Celery
from celery.task import periodic_task
app = Celery('tasks', backend='amqp',
broker='amqp://guest@localhost//')
@ChillarAnand
ChillarAnand / celery chord example.py
Created November 12, 2014 10:09
celery chord example.py
from celery import Celery
from celery import chord
a = Celery()
a.conf.update (
CELERY_BROKER_URL = 'amqp://',
CELERY_RESULT_BACKEND = 'amqp',
CELERY_TASK_SERIALIZER = 'json',
CELERY_ACCEPT_CONTENT = ['json'],
@ChillarAnand
ChillarAnand / signals.py
Last active August 29, 2015 14:09 — forked from voldmar/signals.py
# coding:utf-8
import gc
from sys import modules
import inspect
from optparse import make_option
import weakref
from django.core.management.base import BaseCommand
from django.dispatch import Signal, saferef
@ChillarAnand
ChillarAnand / py & py3 wsgi conflicts
Created November 4, 2014 14:02
py & py3 wsgi conflicts
From your traceback, flask_bootstrap is installed at /usr/local/lib/python3.4/dist-packages in your server.
So you have to add this sys.path[0]
Lets do a simple test.
Create a test2.py and run it with `python test.py`
import sys
print(sys.path)