Archive

Author Archive

A Powerline style prompt for your shell

July 23, 2017 Leave a comment

For a hassle free powerline like shell. Works with bash and zsh.

* Shows some important details about the git/svn/hg/fossil branch (see below)
* Changes color if the last command exited with a failure code
* If you’re too deep into a directory tree, shortens the displayed path with an ellipsis
* Shows the current Python virtualenv environment
* It’s easy to customize and extend. See below for details.

https://github.com/banga/powerline-shell

Categories: bash, zsh Tags:

powerline-gitstatus

July 23, 2017 Leave a comment

Problem:
Git status with powerline

Solution:
https://github.com/jaspernbrouwer/powerline-gitstatus

1. pip install –user powerline-gitstatus

Follow the instructions in on site https://github.com/jaspernbrouwer/powerline-gitstatus
2. Add custom highlight groups.

vim .local/lib/python2.7/site-packages/powerline/config_files/colorschemes/default.json

Example

{
  "groups": {
    "gitstatus":                 { "fg": "gray8",           "bg": "gray2", "attrs": [] },
    "gitstatus_branch":          { "fg": "gray8",           "bg": "gray2", "attrs": [] },
    "gitstatus_branch_clean":    { "fg": "green",           "bg": "gray2", "attrs": [] },
    "gitstatus_branch_dirty":    { "fg": "gray8",           "bg": "gray2", "attrs": [] },
    "gitstatus_branch_detached": { "fg": "mediumpurple",    "bg": "gray2", "attrs": [] },
    "gitstatus_tag":             { "fg": "darkcyan",        "bg": "gray2", "attrs": [] },
    "gitstatus_behind":          { "fg": "gray10",          "bg": "gray2", "attrs": [] },
    "gitstatus_ahead":           { "fg": "gray10",          "bg": "gray2", "attrs": [] },
    "gitstatus_staged":          { "fg": "green",           "bg": "gray2", "attrs": [] },
    "gitstatus_unmerged":        { "fg": "brightred",       "bg": "gray2", "attrs": [] },
    "gitstatus_changed":         { "fg": "mediumorange",    "bg": "gray2", "attrs": [] },
    "gitstatus_untracked":       { "fg": "brightestorange", "bg": "gray2", "attrs": [] },
    "gitstatus_stashed":         { "fg": "darkblue",        "bg": "gray2", "attrs": [] },
    "gitstatus:divider":         { "fg": "gray8",           "bg": "gray2", "attrs": [] }
  }
}

3. Activate the Gitstatus segment.

vim .local/lib/python2.7/site-packages/powerline/config_files/colorschemes/default.json

Example

{
    "function": "powerline_gitstatus.gitstatus",
    "priority": 40
}

4. Show most recent tag reachable in the current branch.

vim .local/lib/python2.7/site-packages/powerline/config_files/themes/shell/__main__.json

Example

"gitstatus": {
    "args": {
        "show_tag": true
    }
}

These are json files. Be careful with syntax. If editing existing files, remember to add the necessary commas where needed.

Source:
https://github.com/jaspernbrouwer/powerline-gitstatus

powerline-status

July 23, 2017 Leave a comment

Problem:
Installing powerline-status

Solution:
1. pip install –user powerline-status
2. Add the following to .bashrc

if [ -d "$HOME/.local/bin" ]; then
    PATH="$HOME/.local/bin:$PATH"
fi

export POWERLINE_COMMAND=powerline
powerline-daemon -q

POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
REPOSITORY_ROOT=/home/rodnee/.local/lib/python2.7/site-packages
. ${REPOSITORY_ROOT}/powerline/bindings/bash/powerline.sh

3. Source .bashrc. It may give some errors. Open up a new terminal and see if the changes have taken effect.

$ source .bashrc
bash: /home/rodnee/.local/lib/python2.7/site-packages/powerline/bindings/bash/../../../scripts/powerline-config: No such file or directory
bash: /home/rodnee/.local/lib/python2.7/site-packages/powerline/bindings/bash/../../../scripts/powerline-config: No such file or directory

Source:
http://powerline.readthedocs.io/en/master/index.html
https://github.com/powerline/powerline/issues/850

Note:
I could not get it to work with zsh. Opted for https://pseudoscripter.wordpress.com/2017/07/23/a-powerline-style-prompt-for-your-shell/ instead.

Categories: bash Tags: ,

jq – a lightweight and flexible command-line JSON processor

July 17, 2017 Leave a comment

jq is like sed for JSON data – you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text.

jq is written in portable C, and it has zero runtime dependencies. You can download a single binary, scp it to a far away machine of the same type, and expect it to work.

jq can mangle the data format that you have into the one that you want with very little effort, and the program to do so is often shorter and simpler than you’d expect.

https://stedolan.github.io/jq/

Categories: Interesting Tags: , ,

This cell phone can make calls even without a battery

July 6, 2017 Leave a comment

“HELLO, HELLO. I am calling from a battery-free phone.” Vamsi Talla’s words in a cluttered lab at the University of Washington in Seattle are barely audible through pops and static. But the fact they can be heard at all, on a nearby Android smartphone, is revolutionary, because Talla’s own cell phone has no battery at all. It draws what little power it needs from thin air.
The prototype cell phone is the culmination of a years-long quest by Talla, a research associate at the lab of Joshua Smith, who researches computer science and electrical engineering at UW. “If you had to pick one device to make battery-free, what would you pick,” asks Smith. “A cell phone is one of the most useful objects there is. Now imagine if your battery ran out and you could still send texts and make calls.”

https://www.wired.com/story/this-cell-phone-can-make-calls-even-without-a-battery/

Categories: Interesting

GoAWS

May 24, 2017 Leave a comment

Problem:
I needed to have a local SNS/SQS setup for testing. GoAWS worked for me.

https://github.com/p4tin/GoAws

Written in Go this is a clone of the AWS SQS/SNS systems. This system is designed to emulate SQS and SNS in a local environment so developers can test their interfaces without having to connect the the AWS Cloud and possibly incurring the expense, or even worse actually write to production topics/queues by mistake. If you see any problems or would like to see a new feature, please open an issue here in github. As well, I will logon to Gitter so we can discuss your deployment issues or the weather.

Categories: Interesting Tags: , ,

http://semver.org

May 23, 2017 Leave a comment

Summary

Given a version number MAJOR.MINOR.PATCH, increment the:

1. MAJOR version when you make incompatible API changes,
2. MINOR version when you add functionality in a backwards-compatible manner, and
3. PATCH version when you make backwards-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

http://semver.org

Categories: Interesting