My custom bash prompt

I wanted more information in my bash prompt, such as date/time and the directory I was in.  Here’s what it looks like:

bash_prompt

And this is what I added in my ~/.bash_profile:


PS1='${debian_chroot:+($debian_chroot)}\d \T > \[$(tput sgr0)\]\[\033[01;32m\]\u@\h\[\033[00m\] : \[\033[01;34m\]\w\[\033[00m\]\n\$ '

Run source ~/.bash_profile and enjoy. 🙂

BTW, there’s also a website that you can use to create your own: http://bashrcgenerator.com/.

Mongo DB: Iterate through a MongoCollection

This is specifically for Mongo 3.x, where MongoCollection is preferred over DBCollection. Adding for personal archiving.


MongoCollection<Document> mongoCollection =
            getMongoCollection(databaseName, collectionName);

        FindIterable<Document> documents =
            mongoCollection.find(eq(COLUMN, "lastName"))
                .sort(ascending("lastname"));

        for (Document document : documents) {
            ...
        }

Importing Apple Notes into Evernote

Just copy and paste the following into the Script Editor and viola!

tell application "Notes"
set theMessages to every note
repeat with thisMessage in theMessages
set myTitle to the name of thisMessage
set myText to the body of thisMessage
set myCreateDate to the creation date of thisMessage
set myModDate to the modification date of thisMessage
tell application "Evernote"
set myNote to create note with text myTitle title myTitle notebook "Imported Notes" tags ["imported_from_notes", "TODO"]
set the HTML content of myNote to myText
set the creation date of myNote to myCreateDate
set the modification date of myNote to myCreateDate
end tell
end repeat
end tell

Source: Importing Apple Notes into EverNote | jeremyrnelson