How to setup BASH custom prompt in Ubuntu
I wanted two things:
- the time in my prompt
- a colour prompt
- it’s located in: ~/.bashrc
- uses Environment Variable: PS1
- time is inserted using: \t
I started here: http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
PixelBeat discussion on coloured command prompts
how to guid for customing the command prompt
2n+r where ‘r’ is the number of redundant drives and 2n+r are the total number of drives in the vdev.
I did this in several steps:
- create an md5 dump of the files system in question. For this I used my favourite command line tool `md5deep`,
- sort the file based on file size then md5 hash (sorted from largest to smallest), and
- remove entries that are not duplicate entries.
Although this could be completed in one step, I have broken it into several steps for my own clarity.
generate hashes using md5deep
md5deep -rze ~/documents/ > dump.md5.1
-r : recurse subdirectories
-z : includes file size
-e : displays progress on each file
recreate the hashes without filesize (optional)
I wanted the hashes in two forms, one with file sizes, and one without. I first created the hash set with file sizes and then parsed that to remove it from the front of the line. This is a lot quicker than hashing all the files twice.
sed to the rescue
sed -e 's/^[ ]*[0-9]* //' dump.md5.1 > dump.md5.2
simply enough, I know the line commences with any number of spaces (including zero spaces), then a number that is the file size. This can only be a set of digits, and finally two spaces (unseen between the final asterisk and double slash).
dav3@dubunt:~$ tail temp.md5
2111 4ceaa380370a537da5c0e36f932df537 /var/log/syslog.7.gz
86400 4efaef324ae83db0549e199a3685cdc3 /var/log/wtmp
346938 9a254850fcd98d94eb991f591eff4772 /var/log/udev
109440 8353823cde9dcfd415e2c639e2db4924 /var/log/wtmp.1
56641 1e0c5a881f6e9bd0f8a8c60461051368 /var/log/Xorg.0.log
9030 5ec0e371a8841a9f9e46cbe0ec128c36 /var/log/Xorg.1.log
167150 ad1d9c65dd2edd089ba3e8388f68f1f9 /var/log/Xorg.0.log.old
41438 416bf352c4d00d8912c827bdbc5e9c09 /var/log/Xorg.1.log.old
6468 06a6770c50edd13140279fec4eacd805 /var/log/Xorg.failsafe.log
6468 3659d35af858878602b60ed053f32df2 /var/log/Xorg.failsafe.log.old
dav3@dubunt:~$ sed -e 's/^[ ]*[0-9]* //' < temp.md5 > temp.md5.2
madivad@garage:~$ tail temp.md5.2
sort largest to smallest
we need to sort the file based on two keys. Firstly, the file size then the hash.
sort -n -r -k1,1 -k2,2 < temp.md5 > temp.md5.3
We COULD just sort by hash and then by size, but it’s possible to get the same file hash for two files that are of different size and we are distinctly after a list based on largest files first grouped by hashes (because it likely we’re going to have files with the same file size but they will be different files. Which leads us to…
remove lines that are not duplicated elsewhere
We can now parse this list through unique:
uniq -w 40 -d -c < temp.md5.3 > temp.md5.4
Whilst removing a naked USB key from an internal USB port on this server with a pair of long nosed pliers, the pliers slipped and smashed a resistor off the key. That’s no great loss. I can always put it back on.
If I can find it!
The problem is, I can’t find it.
Where are you my pretty? Come out, come out, where ever you are?
It wasn’t until I actually typed this in myself, and read it (and said it out loud to myself) half a dozen times that I finally understood this.
Apparently “buffalo” is a term to bully, I’ve never heard it before, but in that context, buffalos should really stop buffaloing Buffalo buffalos, or they themselves will find themselves the subject of Buffalo buffalos buffaloing Buffalo buffalos… Reminds me of a Thai tongue twister, but that’s subject to another post.
But now we’re apparently set to save even more in 2016 and 2017 by cutting loopholes distinctly put in place by the then transport minister urging Sydney-siders to find “ways to beat the system“.
Well, apparently they have with the 8 trips in two days deal, and all remainder trips are free. So for the fact that a few people are getting out there and walking between stations and getting active and healthy, the powers that be are recommending plans to scrap whatever loophole exists and charge up to 3 times more for the Family Sunday Funday… Well not anymore.
What got me was one particular quote from the online edition of the Sydney Morning Herald:
The proposed changes would affect commuters across all modes of public transport but the tribunal said more than 60 per cent would pay less in 2016 to 2017. But by 2018, however, commuters would be paying an average of 8 per cent more per journey
So commuters saved when it was brought in, and we’ll be saving over the next two years as well.
Rail fares and travel in NSW going down over three years?
I think someone is selling porkie pies!
Next in this session: How to get a common sense government
A modern, open source text editor that understands web design.
With focused visual tools and preprocessor support, Brackets is a modern text editor that makes it easy to design in the browser. Try Creative Cloud Extract (preview) for Brackets for an easy way to get clean, minimal CSS straight from a PSD with no generated code.
I’m currently analysing some data that includes birth dates. If the persons birthday isn’t known, there is a flag which indicates it’s an estimate, and the day and month are set to one. New Year’s Day.
Obviously the dataset indicates there are a lot of people born on the first of the first, and I’m trying to work out how many people have been labelled as having New Year’s day as a birthday and been incorrectly entered as an actual date. As a result, I did a Google search and came up with the attached birth date heat map. At first impression you may think that the data means that far fewer people are born around the beginning and end of the year, but that is in fact not what the image shows.
Matt Stiles posted about both the birth date heat map itself as well as an interpretation of it based on research data he obtained from the Centers for Disease Control and Prevention (CDC) National Vital Statistics Reports
New York Times Post: How Common Is Your Birthday?
Matt Stiles: How common is your birthday
Matt Stiles: How common is your birthday pt2