Skip to content

Instantly share code, notes, and snippets.

View pcx's full-sized avatar
💯
set the controls for the heart of the sun

Phaneendra Chiruvella pcx

💯
set the controls for the heart of the sun
View GitHub Profile
@pcx
pcx / .dir-locals.el
Created May 10, 2014 09:30
.dir-locals.el for python-mode and Django
((nil . ((python-django-project-root
. "<path-to-project-root>")
(python-django-project-settings
. "<settings-module-name>")))
(python-mode . ((python-shell-interpreter . "python")
(python-shell-virtualenv-path
. "~/.virtualenvs/<virtualenv-name'")
(python-shell-interpreter-args
. "~/<project-path>/manage.py shell"))))
@pcx
pcx / eflu-devthon
Last active August 29, 2015 13:55
Calculate mostly frequently occuring words (including their synonyms)
import sys
from nltk.corpus import stopwords, wordnet
from nltk.probability import FreqDist
if len(sys.argv) < 2:
print("Usage: python eflu.py path-to-file")
sys.exit(1)
f = open(sys.argv[1])
@pcx
pcx / pr.md
Created June 22, 2013 20:39 — forked from piscisaureus/pr.md
Check out pull requests locally.

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@pcx
pcx / gist:3624276
Created September 4, 2012 18:04 — forked from attaboy/gist:1346280
Destroy the localStorage copy of less.js client-side-generated CSS
// Destroys the localStorage copy of CSS that less.js creates
function destroyLessCache(pathToCss) { // e.g. '/css/' or '/stylesheets/'
if (!window.localStorage || !less || less.env !== 'development') {
return;
}
var host = window.location.host;
var protocol = window.location.protocol;
var keyPrefix = protocol + '//' + host + pathToCss;
@pcx
pcx / redis_session_backend.py
Created April 10, 2012 05:41 — forked from mikeyk/redis_session_backend.py
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
@pcx
pcx / basic-git-commands
Created October 19, 2011 11:15
Basic git command reference
git status -s
first column --> shows difference between committed and staged
second column --> shows difference between staged and unstaged
git diff --> changes between staged and unstaged
git diff --cached --> diff between committed and staged changes
git diff HEAD --> diff between committed and unstaged
--stat --> shorter summary of changes