Highlighted prompt for production shells
Insert into ~/.bashrc
and reload afterwards: source ~/.bashrc
PS1='${debian_chroot:+($debian_chroot)}\[\033[41;33m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
Related cards:
Highlight your prompt on production machines
Next in our series on not shooting yourself in the foot: Doing a sudo shutdown -h now on the main database server right before you head home to cook dinner for six.
Removing ANSI color codes from Rails logs
The colors in Rails log files are helpful when watching them but, since they are ANSI color codes like ^[[4;36;1m
, can be annoying when you are reading the logs with a tool that does just prints those control characters (like less
or vim
).
...
Always show all form errors during development
You've been there: A form cannot be submitted, but you don't see a validation error because the field at fault has no corresponding input field on the form. Because this is usually a bug, you insert debug information listing all errors into the fo...
Customize your Bash prompt
The shell variable PS1
holds your bash prompt. You might want to change it to serve your needs best. Here is how to:
General
- non-printing escape sequences in your prompt have to be inclosed in
\[\e[
and\]
so your shell can...
Remove resource fork files from a FAT volume on MacOS
Be careful!
The following solution will delete files on a volume. If you don't know exactly what you're doing, you can run into big trouble with your computer.
I play mp3 files on my car stereo that are stored on a SD-C...
How to kill a Rails development server by force
Sometimes, the rails dev server doesn't terminate properly. This can for example happen when the dev server runs in a RubyMine terminal.
When this happens, the old dev server blocks port 3000, so when you try to start a new server, you get the er...
Using ngrok for exposing your development server to the internet
Sometimes you need to access a dev server running on localhost from another machine that is not part of the same network. Maybe you want to use your phone to test a web page, but are only in a guest WiFi. In the past, we often used [some port forw...
Colorful output for several linux command line tools: grc
Because colors improve readability so much.
On Ubuntu 18.04 you can install it with sudo apt install grc
From github:
For the impatient - try following commands:
grc netstat
grc ping hostname
grc tai...
Read your mail in networks that forbid e-mail traffic
If you are connected with a network that forbids e-mail traffic but allows SSH, you can tunnel your e-mail connection through a trusted, intermediary server:
sudo ssh -i /home/local-user/.ssh/local-user.key -L 143:mail-server.tld:143 remote-...
Manipulate color with Sass functions
Sass comes with many built-in functions to manipulate color. Some of the more interesting functions include:
adjust-hue($color, $degrees)
Changes the hue of a color.
`lighten($col...