I'm learning Django with Obey the Testing Goat. This page is a draft of my miscellaneous notes.
Currently on this chapter: https://www.obeythetestinggoat.com/book/chapter_javascript.html
Friday, August 18, 2017
My temporary development environment
Here is how I set up my tools on a computer I'm temporarily using, such as one at the library.
https://github.com
Putty
- Download putty from www.chiark.greenend.org.uk
- Putty > Window > Colours > ANSI Blue > Red: 60, Green: 60, Blue: 255
- Putty > Session > Default Settings > Save
- Save a new session with the following set:
- Session > Host Name
- Connections > Data > Auto-login username.
Vim
~/.vimrc:syntax enableNote: Superseded by Vim for Python, which is more comprehensive.
set ic
set expandtab shiftwidth=4 smarttab autoindent
Screen
~/.screenrc:shell -$SHELL
termcapinfo * ti@:te@
startup_message off
Bash
~/.bash_profile# EDITOR
export EDITOR=vim
Websites
https://www.blogger.com for note takinghttps://github.com
Creating paths in Python
Let's say you had this tree:
/home/me/example.com/passenger_wsgi.pyIn the Python script, to refer to the directory that is sibling to the script:
/home/me/example.com/virtualenv
os.path.join(os.path.dirname(os.path.abspath(__file__)), 'virtualenv')Note that this will yield the same result even if the script is a symlink to a file located elsewhere, i.e. __file__ refers to the location of the symlink and not the original file.
Linux date command
To format a date, e.g. for use in a file name:
NAME=$(date +arbitrary_string-%F/%H%M)Result:
echo $NAME
arbitrary_string-2017-08-18/1300
Subscribe to:
Posts (Atom)