Archive

Posts Tagged ‘github’

compile and try a Go project on GitHub

Problem
I found an interesting Go project on GitHub (https://github.com/ichinaski/pxl) that I wanted to try. How to compile it?

(This project “pxl” can display images in the terminal).

Solution

GOBIN=$(pwd) GOPATH=/tmp/gobuild go get github.com/ichinaski/pxl

Under Manjaro I had to install the package “gc”, which contains the official Go compiler.

Categories: bash Tags: , ,

How to update a GitHub forked repository?

Categories: Uncategorized Tags: , , ,

open the github page for the current git repository in your browser

February 4, 2016 Leave a comment

Problem
You have a GitHub project and you are in its local folder in bash. How to open the project’s GitHub page with one command?

Solution
I found a bash function for this (credits are at the top in comments):

# Opens the github page for the current git repository in your browser
# git@github.com:jasonneylon/dotfiles.git
# https://github.com/jasonneylon/dotfiles/
function gh() {
  giturl=$(git config --get remote.origin.url)
  if [ "$giturl" == "" ]
    then
     echo "Not a git repository or no remote.origin.url set"
     exit 1;
  fi

  giturl=${giturl/git\@github\.com\:/https://github.com/}
  giturl=${giturl/\.git/\/tree/}
  branch="$(git symbolic-ref HEAD 2>/dev/null)" ||
  branch="(unnamed branch)"     # detached HEAD
  branch=${branch##refs/heads/}
  giturl=${giturl}${branch}
  echo "#" $giturl
  xdg-open $giturl
}

Just add it to the end of your ~/.bashrc file, open a new terminal (or source it) and use the “command” gh in your shell.

For more info on xdg-open see this post.

Categories: bash Tags:

Atom 1.0 has arrived

June 27, 2015 Leave a comment

Atom is a text editor that’s modern, approachable, yet hackable to the core—a tool you can customize to do anything but also use productively without ever touching a config file.” (source)

This text editor is developed by GitHub. I remember the early versions didn’t exist for Linux, so I was disappointed, but this is no longer an issue. The editor is cross-platform and since version 1.0 came out, I decided to give it a try.

It’s very similar to the excellent Sublime Text editor. It’s visible that they copied lots of things from it :) However, ST is not open source and there is one guy behind ST, Jon Skinner. Atom is fully open source with a large community behind it that is hard to beat…

Question
How to use Atom for Python editing?

Answer
I found a blog post that can get you started: http://www.marinamele.com/install-and-configure-atom-editor-for-python . In addition, I also installed the package ‘script‘ that lets you run your script inside Atom.

Atom has the nice feature to change your settings via a GUI. In ST you need to edit JSON files directly.

All in all, Atom seems to be a nice editor. It’s still version 1.0, so I’m sure it’ll improve a lot, but I already like it.

GitHub status page

https://status.github.com/messages

If GitHub is down or slow, visit the address above to figure out what’s going on.

Categories: Uncategorized Tags:

Git push requires username and password

September 15, 2014 Leave a comment

Problem
You want to push a new project to github, but it asks for your username and password each time.

Solution
I found the solution here. Here I copy Davide‘s answer (reformulated a bit):

First, check the remote repository:

git remote -v

which will respond something like

origin  https://yourname@github.com/yourname/yourrepo.git (fetch)
origin  https://yourname@github.com/yourname/yourrepo.git (push)

Execute the following command:

git remote set-url origin git@github.com:yourname/yourrepo.git

Notice that you need to do some transformations: “https://yourname@” is replaced with “git@“, and “/yourname” becomes “:yourname“.

Now “git push” should work fine.

Categories: Uncategorized Tags: ,

how to create a pull request on GitHub

June 20, 2014 Leave a comment

Explained step by step here: http://stackoverflow.com/questions/14680711/how-to-do-a-github-pull-request/14680805#14680805.

In short: fork the repo you want to contribute to; clone it to your local machine; do the changes, commit, then push it back to your repo. Then create the pull request on the web interface of github: visit your repo and click on the “pull request” button. Fill out the necessary information and create the pull request. The project’s owner will be notified about your contribution.

Categories: Uncategorized Tags: ,