I’ve been using
tmux for a while at work, and in particular nested
tmux sessions, one for each server I use regularly handled via a main session on a jump host. There are around 20 different servers I connect to for various tasks and navigating between them all via standard methods was a little tricky. I thought of the idea (which, of course, wasn’t a new thought) of having a fuzzy find so to get to
box4, I could type
I had a look for anything that existed already and found
fzf which seemed really promising. Unfortunately, the servers I’m using didn’t meet the requirements so I wondered how tricky making something like this would be.
Continue reading “Building a basic command palette for Bash”
Seems I’ve been all about the terminal customisation recently…
grep a lot. Multiple times every day without fail. I used
ack for a while when I started at my current workplace as that seemed to be favoured by a lot of the existing devs there. However, I found that not having
ack on some servers meant I was making silly mistakes when using
grep elsewhere. Ever typed this:
grep -R 'variable'
and sat there waiting? Well I have. So I switched away from
ack and became a
grep advocate. This move from
ack might also help explain my
grep default flags, one of which (that I didn’t mention in that post..) is
-P to use
perlre in the search string.
Continue reading “
greping over a codebase, there can be so many different things to trip you up and flag false positives, or files that you definitely didn’t want to
Continue reading “
grep: defaults for web developers”
I’ve always noticed really elaborate examples of what can be achieved with a highly customised
PS1 variable for your bash prompt and recently have spent some time playing with my settings to make my terminal experience better with a few updates. I also felt that I would have benefitted in the past from being able to analyse what my prompt currently does, breaking it down into easier to digest blocks, so I can make more sense of what each part does.
As a result of that curiosity, I’ve created a small page that allows you to paste in an existing
PS1 from your terminal which will then be parsed and previewed with some basic dummy details (which can be changed by clicking on the identifier in the preview area).
I’d like to make it into something like EzPrompt with support for 256, or even true colour additions and collate some useful scripts for displaying additional information, but at the moment it’s useful for seeing what each block does at least.
It seems to cover most of the examples I’ve tested in various searches, but the more inline-code is included, the less it can display.
Check it out here and the source is available on github.
I’ve been working on cleaning up my dotfiles recently and have been playing with my
PS1 and the available colours. In doing so I thought it might be interesting to extract image data from an uploaded image and turn the result into a nearest-match
ANSI image. This is the result! It supports both 256 colour and true colour terminals and can utilise unicode code points to present a clear image in slightly fewer pixels as well as just using background colours and spaces if preferred.
It includes a live preview which I’ve lifted from the bash
Check it out here!
Today I received a 45Mb CSV file for importing into a database… Needless to say the application we were importing to didn’t seem to like the size of the file, for what ever reason… So I knocked up a quite bash script to create smaller ‘chunks’ defined as a number of lines, to make importing simpler.
I’m sure there’s many way in which is can be simplified, so if you know any I’d like the contributions!
It’s run like this:
$ ./csv-chunk.sh large-data.csv 5000
The first argument being the filename and the second argument the maximum number of lines for each ‘chunk’. From that 45Mb megalith, 38 files of around 1.2Mb were produced which didn’t seem to break the other end!
Continue reading “Breaking down large CSV files”