Earlier quoted context omitted.
I can't believe I didn't know about this! Thanks so much :)
I don't want to sound hyperbolic but its kind of a game changer for text editing. I understand why developers don't have it on by default in other text editors (space) but seeing as I don't fill my HDD with movies or games or any other large media like that, i've got all the space in the world.
Ask HN: Best things in your bash_profile/aliases?
151–160 of 288 posts
Re: Ask HN: Best things in your bash_profile/aliases?
#152My most used alias would be: alias fuck='sudo $(history -p !!)' It runs the previous command as root.
Re: Ask HN: Best things in your bash_profile/aliases?
#153Re: Ask HN: Best things in your bash_profile/aliases?
#154 set +H
export HISTIGNORE="&"
alias reset="printf '\033\143'"
alias ls="ls --color=never -p -D '%Y-%m-%d %H:%M'"
alias pmake="gmake -j30"
PS1="\[\e[0;32m\][\w]$\[\e[m\] "
history -w
history -c
I turn off history substitution (sometimes ! get into my program arguments and I don't like surprises), and start with no history on new terminals. I don't trust myself not to run an rm * from a previous session, open another terminal, and hit up one too many times.A little colorization of the terminal prompt, and spicing up of ls output (the colors actually give me trouble, and often I can't read the dark blue items at all.)
But most specifically, I adore the reset alias. Unlike clear, it isn't undone when you scroll up. The built-in reset command takes forever to run and does a bunch of things I don't want.
HISTIGNORE is my absolute favorite. It doesn't log your last command to history if it's the same as the one already there. I'll often run make multiple times to fix compilation errors, and with HISTIGNORE, the command to run the resulting binary is only ever two up keystrokes away.
Re: Ask HN: Best things in your bash_profile/aliases?
#155 shopt -s checkwinsize
shopt -s autocd
To make life better to my taste alias tmux="tmux new -A -s root"
export HISTCONTROL=ignoredups
To distinguish between development, test and production environments by color (VERY userful) export PS1='[\[\e[1;91m\]\u\[\e[0m\]@\[\e[1;31m\]\H\[\e[0m\] \[\e[1;95m\]\w\[\e[0m\]]\\$ '
export PS1='[\[\e[1;92m\]\u\[\e[0m\]@\[\e[1;32m\]\H\[\e[0m\] \[\e[1;95m\]\w\[\e[0m\]]\\$ '
export PS1='[\[\e[1;93m\]\u\[\e[0m\]@\[\e[1;33m\]\H\[\e[0m\] \[\e[1;95m\]\w\[\e[0m\]]\\$ 'Re: Ask HN: Best things in your bash_profile/aliases?
#156The trash-cli utility has some quirks related to mounted drives but once you understand how to set up correctly, aliasing rm to trash can save you from losing files you've deleted by mistake.
Re: Ask HN: Best things in your bash_profile/aliases?
#157 alias mirror='wget -m -r -np -p -k -E'
alias g_short_hash='git rev-parse --short --verify HEAD'
alias g_head_branch='echo "`git symbolic-ref HEAD 2> /dev/null | cut -b 12-`"'
alias g_branch_w_hash='echo "`git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:\"%h\" -1`"'
On OS X: alias sleepnow="pmset sleepnow"
alias netstat_tanp="lsof -Pnl +M -i4 -i6"Re: Ask HN: Best things in your bash_profile/aliases?
#158Earlier quoted context omitted.
I have a similar command, except it keeps the existing addons from my main profile. Which is useful as I need a proxy for different environments for work.
Please share how you did do that, that sounds awesome!
Re: Ask HN: Best things in your bash_profile/aliases?
#159 function remac {
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z
sudo ifconfig en0 ether $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
sudo networksetup -detectnewhardware
echo $(ifconfig en0 | grep ether)
}
Explanation: https://jezenthomas.com/free-internet-on-trains/Also, when I need to share a code snippet I pipe it to this:
alias ix="curl -F 'f:1=
Oh, and perhaps the most important part of my .vimrc: https://github.com/jezen/dotfiles/blob/master/.vimrc#L160Re: Ask HN: Best things in your bash_profile/aliases?
#160I've tried several different, SimpleNote, KeepNote, EverNote... and so on. I have come to a conclusion, that using the default iOS note app is enough for me. Using paper notes while @lectures and rewriting them sometimes to Notes. I'm also using another method of note taking, which I prefer more, but which is not always accessible on the go. I stumbled upon a script here and modified it a little. (changed vim to nano and added some other):
#! /bin/bash
fpath=$HOME/notes.md
if [ "$1" == "cat" ]; then
cat "$fpath"
exit 0
elif [ "$1" == "rg" ]; then
rg "$2" "$fpath"
elif [ "$1" == "nano" ]; then
nano "$fpath"
elif [ "$1" == "--help" ]; then
printf 'Commands: \n-----------------------------------------------\n
$ notes \n
$ notes --help\t\t--\tdisplay this help\n
$ notes date\t\t--\tadd date row to notes\n
$ notes \t\t--\tadd new entry \n
$ notes cat\t\t--\tprint notes using cat\n
$ notes rg \t--\tripgrep notes\n
Remember to use #tags (for easier grepping)!\n\n'
elif [ "$1" == "date" ]; then
{
echo ''
echo '# '"$(date +"%m-%d-%Y-%T")"
echo '-'
} >> "$fpath"
elif [ "$1" == "" ]; then
less +G "$fpath"
else
{
echo ''
echo "$@"
echo ''
} >>"$fpath"
fi
In short, writing $ notes prints out displays the notes and writing $ notes appends a new line. This is extremely powerful because of it's simplicity and easy accessibility in terminal (where I spend most of the time anyway)From thread: Ask HN: Favorite note-taking software? https://news.ycombinator.com/item?id=17532094