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
# Set inotify watch limit high enough for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm). | |
# Create this file as /etc/sysctl.d/60-jetbrains.conf (Debian, Ubuntu), and | |
# run `sudo service procps start` or reboot. | |
# Source: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit | |
# | |
# More information resources: | |
# -$ man inotify # manpage | |
# -$ man sysctl.conf # manpage | |
# -$ cat /proc/sys/fs/inotify/max_user_watches # print current value in use |
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
# .bash_aliases | |
# Source: http://techie-notebook.blogspot.ch/2012/04/making-your-terminal-look-pretty-on-mac.html | |
# enables color in the terminal bash shell | |
export CLICOLOR=1 | |
# sets up the color scheme for list | |
export LSCOLORS=gxfxcxdxbxegedabagacad | |
# enables color for iTerm | |
export TERM=xterm-color | |
# Color Prompt |
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
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 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
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 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/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 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
# source this code in a Bash shell ($ . django-csrftoken-login-demo.bash), | |
# and run with a DB name as parameter (e.g. $ django-csrftoken-login-demo demo) | |
django-csrftoken-login-demo() { | |
# -- CHANGE THESE VALUES TO MATCH YOUR ACCOUNT -- | |
local HOSTING_USERID=9988 | |
local HOSTING_PANEL_USER='[email protected]' | |
local HOSTING_PANEL_PASS='my secret login password' | |
local HOSTING_DB_PREFIX='username_' | |
local DB_NAME=$HOSTING_DB_PREFIX$1 |
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
# DESCRIPTION OF PROBLEM: Implementations of sed, readlink, zcat, etc. are different on OS X and Linux. | |
# NOTE: Put this on top of your script using sed, readlink, zcat, etc. that should work alike on Mac OS X. | |
# cross-OS compatibility (greadlink, gsed, zcat are GNU implementations for OS X) | |
[[ `uname` == 'Darwin' ]] && { | |
which greadlink gsed gzcat > /dev/null && { | |
unalias readlink sed zcat | |
alias readlink=greadlink sed=gsed zcat=gzcat | |
} || { | |
echo 'ERROR: GNU utils required for Mac. You may use homebrew to install them: brew install coreutils gnu-sed' |
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
# Copyright 2014 Peter Bittner <[email protected]> | |
# | |
# 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 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/bash | |
# Make sure you've created a VirtualEnv beforehand: $ mkvirtualenv test && workon test | |
# @author Peter Bittner <[email protected]> | |
# @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 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: "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: | |
# |