This file contains 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: "Automatically activate virtualenv" by Kurt Neufeld | |
# URL: http://www.burgundywall.com/tech/automatically-activate-virtualenv/ | |
# Date: 16-Oct-2013 | |
# | |
# Usage: | |
# | |
# 1. Create an empty .venv file in your project home: touch .venv | |
# 2. Put this file in your home directory: cp .bash_virtenv ~/ | |
# 3. Include it in ~/.bashrc as follows: | |
# |
This file contains 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/bash | |
# Make sure you've created a VirtualEnv beforehand: $ mkvirtualenv test && workon test | |
# @author Peter Bittner <django@bittner.it> | |
# @license GPLv3, https://www.gnu.org/copyleft/gpl.html | |
PROJECT=ascalcio | |
printf 'Uninstalling Django, please wait ...' | |
pip uninstall -q Django | |
rm -rfv manage.py $PROJECT | |
# As an alternative to above, the following will uninstall all packages: |
This file contains 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
# Copyright 2014 Peter Bittner <django@bittner.it> | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This file contains 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/bash | |
# Show the Apache status diagram (free and occupied connections). Ctrl+C to exit. | |
# usage: apache-status servername | |
apache-status() { | |
while true; do | |
ssh -t $1 "TERM=xterm-color && clear && apache2ctl status && sleep 2" | |
done | |
} |
This file contains 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
17,21c17,22 | |
< if arg == '-h' or arg == '-?' or arg == '--help': | |
< print(('Usage:\n' + \ | |
< ' {0} -h |-? | --help\n' + \ | |
< ' {0} [-l|--line line] file[:line]\n' + \ | |
< ' {0} diff file1 file2').format(sys.argv[0])) | |
--- | |
> if arg in ['-h', '-?', '--help']: | |
> print('Usage:\n' | |
> ' {0} -h |-? | --help\n' |
This file contains 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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
/* | |
* From pelican theme Cid | |
* original: https://github.com/hdra/Pelican-Cid/blob/master/src/sass/_manni.scss | |
* compiled: https://github.com/hdra/Pelican-Cid/blob/master/static/css/cid.css | |
*/ | |
.highlight |
This file contains 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
def merge_dicts(*dict_args): | |
""" | |
Given any number of dicts, shallow copy and merge into a new dict, | |
precedence goes to key value pairs in latter dicts. | |
""" | |
result = {} | |
for dictionary in dict_args: | |
result.update(dictionary) | |
return result |
This file contains 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
# Python string concatenation | |
# Appending strings to an existing string is way faster than prepending. | |
# Source: https://groups.google.com/d/msg/comp.lang.python/AzYJ0LAWe-w/wBLtn5BJIBsJ | |
python -m timeit -s "v = 'x' * 10; out = ''" "out = out + v" | |
# prints: 10000000 loops, best of 3: 0.0511 usec per loop | |
python -m timeit -s "v = 'x' * 10; out = ''" "out = v + out" | |
# prints: 100000 loops, best of 3: 52.7 usec per loop | |
python -m timeit -s "v = 'x' * 10; out = ''" "out += v" | |
# prints: 10000000 loops, best of 3: 0.053 usec per loop |
This file contains 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/bash | |
# | |
# RabbitMQ setup for DjangoEurope | |
# (c) 2017 Peter Bittner <django@bittner.it> | |
# based on instruction provided by DjangoEurope | |
# MIT license | |
RABBITMQ_HOME=$HOME/rabbitmq | |
RABBITMQ_ENV=$HOME/.rabbitmq_env | |
RABBITMQ_NODE_PORT=62024 |
This file contains 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
#!/usr/bin/env bash | |
# ----------- | |
# Check files for DOS/Windows line endings. | |
# ----------- | |
[ -a "$1" ] || { | |
echo 'Check files for DOS/Windows line endings.' | |
echo "Usage: ${0##*/} {filename}" | |
exit 0 | |
} | |
which dos2unix > /dev/null || { |
OlderNewer