Last active
December 17, 2015 07:58
-
-
Save flashingpumpkin/5576233 to your computer and use it in GitHub Desktop.
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
| export PYTHONSTARTUP=/etc/profile.d/pythonrc.py |
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
| #!/usr/bin/env python | |
| import os, sys | |
| import math, random | |
| import atexit | |
| import rlcompleter, readline | |
| histfile = '%s/.python_history' % os.environ['HOME'] | |
| max_size_bytes = 1000000 | |
| max_size_lines = 10000 | |
| if not os.path.isfile(histfile): | |
| with open(histfile, 'w'): | |
| pass | |
| def writehist(): | |
| global histfile | |
| global max_size_lines | |
| global readline | |
| readline.set_history_length(max_size_lines) | |
| readline.write_history_file(histfile) | |
| if sys.platform == 'darwin': | |
| readline.parse_and_bind ("bind ^I rl_complete") | |
| else: | |
| readline.parse_and_bind("tab: complete") | |
| readline.read_history_file(histfile) | |
| atexit.register(writehist) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment