This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| grep -rl "this" . | xargs sed -i "s/this/that/g" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ########################################################## | |
| # Distribute a python library as a "zipped egg" directory | |
| ########################################################## | |
| # build an egg using a temporary dist directory and keeping the build directory | |
| tmpdir="/tmp/pybuild-$(date +%Y-%m-%d-%H-%M-%S)" | |
| mkdir $tmpdir | |
| python setup.py bdist_egg --keep-temp --dist-dir $tmpdir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apt-get clean | |
| cd /var/lib/apt | |
| mv lists lists.old | |
| mkdir -p lists/partial | |
| apt-get clean | |
| apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django import forms | |
| from django.contrib import admin | |
| from .models import SphinxDocument, EpydocDocument | |
| CATEGORY_CHOICE_FIELD = forms.ModelChoiceField( | |
| Category.objects.all(), | |
| label = "Category", | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # if you want to do `git push` rather than `git push codebase` where codebase is the remote | |
| git branch --set-upstream master codebase/master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Lazy(object): | |
| def __init__(self, attr): | |
| self.parts = attr.split('.') | |
| self.cachedname = '__' + '__'.join(self.parts) | |
| def __get__(self, obj, type=None): | |
| try: | |
| attr = obj.__dict__[self.cachedname] | |
| except KeyError: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Lazy(object): | |
| def __init__(self, attr): | |
| parts = attr.split('.') | |
| self.parts = tuple(parts[:-1]) | |
| self.attr = parts[-1] | |
| self.cachedname = '__' + '__'.join(self.parts) | |
| def __get__(self, child, type=None): | |
| try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| grep -rl "{% url [^'\"]" . | xargs sed -i "s/{% url \([-_:a-zA-Z0-9]\+\) /{% url '\1' /g" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #/etc/init/myproject.conf | |
| description "myproject" | |
| start on runlevel [2345] | |
| stop on runlevel [!2345] | |
| env RUN_AS_USER=root | |
| env VENV=/www/myproject.env | |
| env CMD="$VENV/bin/python $VENV/myproject/manage.py supervisor" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd /tmp | |
| wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.2.tar.gz -O elasticsearch.tar.gz | |
| tar -xf elasticsearch.tar.gz | |
| rm elasticsearch.tar.gz | |
| sudo mv elasticsearch-* elasticsearch | |
| sudo mv elasticsearch /opt | |
| curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz | |
| mv *servicewrapper*/service /opt/elasticsearch/bin/ |
NewerOlder