David Winterbottom
codeinthehole.com · Personal blog · on HN since 2012
David Winterbottom, a Python and Django developer, writes about command line tips, git practices, and testing.
What HN saysHN commenters link his tips on incremental history searching with .inputrc and on git hooks, which they find practical.
18HN people shared it
6linked it in comments
18stories submitted
84story points
6 months agolast shared
2012people per year2026
Most-shared posts
- 1An LLM TDD Loop2 people · 8 points · first shared 2024 · 1 comments on HN
- 2Effective pull requests and other good practices for teams using github2 people · 5 points · first shared 2012 · discussion on HN
- 3Incremental History Searching with .inputrc2 people · 1 points · first shared 2018 · discussion on HN
- 4The most important command line tip incremental history searching with inputrc2 people · first shared 2016
- 5Cacheback - asynchronous cache refreshing for Django1 people · 47 points · first shared 2012 · 1 comments on HN
- 6A useful template for commit messages1 people · 6 points · first shared 2015 · discussion on HN
- 7PyPI README badges1 people · 3 points · first shared 2013 · discussion on HN
- 8Prefer WebTest to Django's test client for functional test1 people · 3 points · first shared 2012 · discussion on HN
- 9Command-line tips for effective release anouncements1 people · 2 points · first shared 2014 · discussion on HN
- 10Tips for using a git pre-commit hook1 people · 2 points · first shared 2013 · discussion on HN
- 11Easy to change1 people · 1 points · first shared 2018 · discussion on HN
- 12An SSH tip for modern AWS patrons1 people · 1 points · first shared 2015 · discussion on HN
- 13Advanced pull-request crafting1 people · 1 points · first shared 2018 · discussion on HN
- 14Vim's Useful Lists1 people · 1 points · first shared 2023 · discussion on HN
- 15Continuously rebuild your project1 people · 1 points · first shared 2014 · discussion on HN
What HN people wrote when they linked it
goku12 · 2025-02-17
Committing git hooks to the repo is possible. These are the 2 ways in which they're commonly handled:
1. Link the scripts from the worktree to the .git/hooks directory - perhaps using a bootstrap script.
Ref: https://codeinthehole.com/tips/tips-for-using-a-git-pre-commit-hook/
2. Declare the directory in the worktree to be the local git hooks directory.
Ref: https://knpw.rs/blog/direnv-git-hooks
pdkl95 · 2018-06-14
You should try binding UP/DOWN to history-search-backward and history-search-forward[1]. Adding this to your ~/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
enables searching by the current line's prefix in all programs that use readline (a lot of languages use readline for their REPL). That is, if you type "cp<UP>" you immediately get the previous command that started with "cp", regardless of how far back it is in your history.
[1] https://codeinthehole.com/tips/the-most-important-command-line-tip-inc…
Myrmornis · 2016-09-13
Agreed, but even nicer than control-r are the readline functions `history-search-backward` and `history-search-forward`.
Personally I bind them to up/down which on OS X at least involves:
# Put this in some file like ~/.readline-bindings
"\e[A": history-search-backward
"\e[B": history-search-forward
# And this in your ~/.bashrc or ~/.zshrc
bind -f ~/.readline-bindings
That way if you haven't typed any input it behaves like normal up (previous command), but if you've typed some characters it only retrieves matching commands.
http://codeinthehole.com/writing/the-most-important-command-line-tip-i…
ldiracdelta · 2016-08-18
If you put this in your `~/.inputrc` [1]:
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char
you can start typing a previous command and go up through your history for all commands starting with whatever you currently have typed into the bash shell. Reset the scrolling through the history with `ctrl+c`.
Personally, I hate that powershell remembers your position in the shell history. I don't want to maintain a mental model of the shell history rollodex and where I am in it. That's one less part of my brain that I can't use for thinking about the code. If I have a set of commands to type over and over:
history 20 | head -10 | sed -r 's/^ *[0-9]+ *//g;' > new_script.bash
* [1] http://codeinthehole.com/writing/the-most-important-command-line-tip-i…
maerF0x0 · 2016-06-13
There is already a ag plugin for vim that will jump you to the matches.
See: https://github.com/rking/ag.vim
or see: http://codeinthehole.com/writing/using-the-silver-searcher-with-vim/
niftich · 2017-05-19
They probably are.
But some applications will decode the percent-encoding too early in the process of normalizing, security-escaping, and processing the URL. Encoded slashes in URLs are problematic [1][2][3][4][5].
[1] https://httpd.apache.org/docs/2.4/mod/core.html#allowencodedslashes
[2] http://stackoverflow.com/questions/3235219/urlencoded-forward-slash-is…
[3] http://codeinthehole.com/tips/django-nginx-wsgi-and-encoded-slashes/
[4] http://stackoverflow.com/questions/3040659/how-can-i-receive-percent-e…
[5] https://groups.google.com/forum/?fromgroups#!topic/django-users/31oV1W…