As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label GitHub. Show all posts

I reported two spam accounts on GitHub, one is selling love spell via phone, sounds ridiculous, but its true and I actually had just reported another one just a few days ago. The other account is selling skin care product, which has seemingly computer generated text with product name and a link embedded in the text and that totally make no senses as you read the words. Curiously, if its for avoiding lower ranking in search engine results or GitHub actually has some sort of detection mechanism in place already that we dont know.

What else today:

  • The grow light doesnt seem to work, or its because the soil was dry, I just realized that, the surface felt really dry. I also swapped one LED with a red LED. I am considering to stop since the temperature is going back up.
  • Planted another onion bottom, which would be solely for greens.
  • The pruned green yardlong bean has died, the stem is soft. It might already dead, I just didnt realize.
  • One tomato truss was damaged by the cold, which is already flowering, I cut it off and stuck it with sweet potato to root. The two seedlings I thought might not survive have perked themselves up.
  • The preparation for potato growing is slow, barely half of the bag of shredded cardboard.

One and a half years ago, I released first version of vcsstat.sh and I regularly use it to check my commit statistics. A few days ago, I stared to modify vcsstat.sh, then hours ago, I had an idea, inspired by GitHubs Contributions calendar, which they added last month with some other features as new contribution tab in GitHub profile page.

Now, I have similar calendar right in terminal, just the way I like it.

The following screenshot was take from output of new version 0.2. The box-drawing Unicode characters and colors render the different amount of commits. The calendar is just like the one on GitHub, but always starting from ISO week 1 at the leftmost column. The rows are starting from Monday to Sunday, 7 rows for each year.

https://lh6.googleusercontent.com/-pmy5cph0Zw8/UQ6UIjEduyI/AAAAAAAAEaQ/hKDTOZWAuj8/s800/vcsstat.sh%2520-%2520commit%2520calendar.png

Commit calendar

The calendar prints out full years, from year of first commit to year of last commit. You can see there is a header line of abbreviation of months, with the year number replacing the position of January.

The corresponding list of changes, additions and deletion, is shown below.

https://lh4.googleusercontent.com/-2xZlGFL7Rls/UQ6UJvC3gqI/AAAAAAAAEaY/RCDjyt5tySY/s800/vcsstat.sh.png

This is basically what vcsstat.sh did before, I only added a total number for this output, although I did edit the code for little better performance.

The calendar uses Unicode and ANSI colors to render, some may not like them or environment may not be able to support, so I also added some options to turn them off. Next screenshot shows output without colors:

https://lh6.googleusercontent.com/-F5Mz3mkaJMk/UQ6UHb827EI/AAAAAAAAEaI/d10VfQSft-I/s800/vcsstat.sh%2520-%2520commit%2520calendar%2520-%2520no%2520color.png

Disable color output

The final one is non-Unicode output:

https://lh6.googleusercontent.com/-jlG8EZDWXok/UQ6UGUB2hnI/AAAAAAAAEaA/xAyiYmPZFQA/s800/vcsstat.sh%2520-%2520commit%2520calendar%2520-%2520no%2520Unicode.png

Disable Unicode output

There may be some confusing between different outputs, but the calendar isId sayjust for a feeling, dont look into it too seriously. If you would like to try it, go to vcsstat.sh project. Its just a Bash script and it can scan current (sub-)directory of Git or Mercurial repositories.

Weird behavior

Around last May1, I started to notice a weird behavior: some people like to clone a repository but without adding any commits on GitHub, Google Code, or any other source code hosting provider I believe. A few people even fork my dotfiles, that really loses me.

For example in the following screenshot, it shows only one of 18 clones has made some changes:

Those 17 clones have never been done with anything.

Rationale?

I have long try to understand or to explain to myself why they do that. Whenever I see cloned repositories under some peoples account, which have no commits, I ask myself

Why?

Whats the point of cloning a repository under ones account and making no commits to it? Why not just clone the original repository to local even you do plan to make some commits locally without pushing to the public accessible repository.

Maybe they might commit or contribute some changes later?

That still makes no sense at all. You can always push to another repository later on, you do not need to clone to your account first.

If you are one of this type of cloner or you know their reasons, please leave a comment, Id like to understand.

My cloning

Whenever I want to contribute, I

  • Clone the original repository to local, then work on it.
  • Commit and commit.
  • go to hosting provider, fork or clonewhatever they call itthe original repository under my account
  • Edit local repository configuration, change default push path to the one under my account
  • Push changes.
  • create a pull request.
  • once pulled, I delete the forked or cloned repository unless I am still going to make more contributions.

The reason I dont fork or clone before working on it, thats because sometimes you realize that your idea may not be good enough once you seriously read the source code in order to make changes. You may drop your idea. I make sure I have changes committed before I fork or clone. Only do that when I am sure I have something to contribute or to push.

I dont keep repository whose commit history is part of original. I really dont understand why so many people keep a clone, an super outdated clone under their account. Well, not just one, I have seen a few people own accounts which contain dozens of outdated clones and thats all those accounts have: full of outdated clones.

Use star or watch

One reason I can remotely guess is, they use fork or clone to track repository. If so, then please:

  • If you like a repository, star it, dont fork or clone it.
  • If you are interested in changes of a repository, just watch it!

You wont lose them, for example, on GitHub, you have a special Stars page lists all repositories you have stared. Similar list can also be found on your Google Code profile page.

Once I have tried to search a repository on GitHub via search engine, there are some real clones, but when mixed with those without additional commits, its really hard to see which it is original or good forks. You need to understand, sometimes forks can get even higher rankings in search results if more people use the forked ones.

And there are also people fork or clone by creating a new repositories, not by those fork or clone buttons. This adds another dimension of troubling. Things sometimes can get little messy.

From my perspective and habit of keeping my online account in clean state as much as possible, those people stuff trash or useless repositories in their account. I am by no means saying those repositories literally are trash, just its useless since they are outdated. Its like hoarding online, those forkers or cloners are repository hoarders in my opinion, thatd be how I describe them as I dont know why they do it.

Please do understand that I am not trying to criticize those peoples behaviors but simply let them know there is no need to do so for themselves or for others. They is no absolutely right way or wrong way about how you use, but there does have better way to do things if criteria meet.

[1]I first noticed at 2012-05-23T02:38:45Z.

GitHub has just pushed out the latest feature: Contributions. I took a screenshot of my profile page:

I love this new feature. You can clearly see what you have done towards others repositories and the amount at when you do. That calendar is definitely the spotlight of the entire feature. Longest streak is probably the most interesting number among the statistics to me. Only 8 days streak coding, I must code harder!

Coincidentally, I was thinking something Id call Contribution Ratio. Its basically calculating commits to others repositoriesdirect commit or via pull requests are all countedover total commits, then you have a percentage, the higher means you contribute more. Although, it doesnt really indicate you have no contributions even when its 0%, you may be maintaining a popular open source project under your account name.

Off-topic: as you can see I know use GetSatisfaction to handle feedback, previously Google Moderator. If you have any suggestions, please add it there.

I want to see such number because I feel I havent contributed any recently, and would like to know how low my number is. However, I didnt start it, because itd be just a number, even that wouldnt take long to code it. If you want to see such number, add your vote on that idea.

If you check out GitHub (GH) Explore regularly and you are also a bitbucket user, you may already found bitbucket (BB) Explore's trending is pretty much stationary, bit GH's is not. I am not saying GH's is better, but you want to discover new projects and that's main purpose why you visit Explore page.

As you may notice GH uses Topsy to provide the list along side with featured repos by Changelog. I guess BB's trending is based on the pageviews data on BB's server, BB also has featured repos and tweets mentioning bitbucket.

I found it is not hard to get the similar list on Topsy which you see on GH's Explore. From that, you can have a list for BB's repos. It is not only from Twitter, you can also choose data from Google+.

If Topsy API was not commercial, I would already write some code more my convenience because reading through those results on Topsy is not as easy as you read the list on GH's or BB's Explore. Right now, I've bookmarked it, it's better than that stationary list.

Hmm... Topsy also provides email alerts and RSS feed, maybe filter with Yahoo! Pipes?

On GitHub, you can use Fenced Block to have code block syntax-highlighted, for example:
```js
var a=1;
```
Also it seems to be only way to have syntax highlighting. The indentation doesn't enable highlighting from what I see.

This will confuse Vim's syntax highlighter because that is not part of standard syntax of Markdown. Although, it is fairly coder-readable, you know it is a code block. I am not sure Markdown processors will do when they don't understand such syntax.

But that is not a major issue to me, the sort-of-incorrect syntax highlighting in Vim is. Not only Vim is confused, so am I. It is very hard to read the content while you are writing. (Note: I was using this mkd.vim)

I found a fix for it. The ideal way to have additional syntax is to add an after-syntax, normally they are stored in ~/.vim/after/syntax. So I added a file with the following content:
syn region markdownCode matchgroup=markdownCodeDelimiter start="``` \=" end=" \=```" keepend contains=markdownLineStart
I didn't use that fix, it seems to have slight glitch like default markdown syntax highlighting from Vim for fenced block. But maybe it is because I messed some stuff up while I was trying with that mkd.vim. Right now, I am only using highlighting from Vim.

Everyday, there are some new services are born and some have to be shut down. There is no eternity for many things. Websites certainly don't have that.

So, here is the one-liner for Gists:
page=0; while let page++; wget -q -O - "https://api.github.com/users/$USER/gists?page=$page&per_page=100" | grep -o 'git://.*\.git'; do :; done | while read git_url; do git clone $git_url; done

and for public repos:
page=0; while let page++; wget -q -O - "https://api.github.com/users/$USER/repos?page=$page&per_page=100" | grep -o 'git://.*\.git'; do :; done | while read git_url; do git clone $git_url; done

You may need to edit $USER to match your username on GitHub.

This is only for one-time run and doesn't have any error handling. You should run it in a specifically created directory for storing repos. It won't update if you add new repos afterwards. But you can add some condition check for updating when a repo is already presented in the filesystem.

It's not the time for me or anyone else to use it, since GitHub is alive and probably won't be out of business or gets closed anytime soon.

I have this thought because there is another service closed, which I used when I was still on Twitter, due to being merged into bigger company.

Six or seven years ago, I lost data on a harddisk. Since then, I have been trying not to store data on local disks. I am lazy, never want to do the backups. It's not like it's hard, the script is easy to write, just I don't like put the backup harddrive online when the system only needs it once a while when the backing up is in progress.

Certainly, you can pay some money for so-called cloud storage or just remote backup storage. It doesn't seem to matter to me, someday they will be gone and does a backup of a backup is like, well, WTH was I doing that in the first place?

Anyway, for backing up public stuff on GitHub is easy.

Updated on 2012-03-15: If you also use Bitbucket, here is the one-liner.

1Switching from GitHub?

Probably not entirely but I will be starting to use bitbucket.

I signed up new account a few days ago because I needed to contact a projects owner. After that, I thought this might be a great timing for using it. Why? because of the recent hack on GitHub.

When I read that blog post, I couldnt get a hold about it since I dont know anything about Ruby and Rails and, to be honesty, I didnt really care. But I did sense some fishy behind that post because it said Temporary suspension and it didnt entirely criticize everything of that user. It is just strange.

Its GitHubs side of story, I began to read more when Hacking Rails (and GitHub) showed up in my reader.

To cut the story short, hopefully I did read enough materials, the user, Egor Homakov, reported a security issue in Rails to Rails project regarding the mass assignment. Which can be exploited by malicious appending extra POST fields. (Not sure if it will also works for GET, again, I know nothing about Rails)

The users report got closed without any actions to resolve the issue, then he decided to demonstrate how much damage could be done by this issue by doing things on GitHub.

I dont agree such demonstration, because a hack is a hack if without permission, no matter what your intention is. I also dont feel GitHubs blog post was fair to that user, even he hacked. From what I read, GitHub was avoiding the finger pointing.

But this hack isnt the major point of why I wanted to use bitbucket. On February 9, I contacted GitHub after I saw a public repo, which specifically noting that it is not a open source project.

If you have used GitHub, you must have already been familiar with gh-pages branch.

I don't like have different code base from the pages branch, so in my projects, master == gh-pages, and many of projects are doing the same. If you have documents like library reference which is generated by source, then you probably will use different base.

For a very long time, I had to do with these commands as follow in order to update that branch:
git checkout gh-pages
git pull . gh-pages
git push
git checkout master

It was just plain silly of me. I did google for it, but not RTFM, I didn't get any useful results, probably used wrong keywords. I finally found the correct answer with correct search keywords, here is the answer:
git push origin master:gh-pages

Here is from manpage git-push:
<refspec>...
    The format of a <refspec> parameter is an optional plus +, followed by the source ref <src>, followed by a colon :,
    followed by the destination ref <dst>. It is used to specify with what <src> object the <dst> ref in the remote
    repository is to be updated.
    [...]
    The <dst> tells which ref on the remote side is updated with this push. Arbitrary expressions cannot be used here, an
    actual ref must be named. If :<dst> is omitted, the same ref as <src> will be updated.

Well, it's all in the manual and I was actually using a shorthand by omitting the <dst>. It's good to know.

So what if you try to omit <src> part? (I am glad I already know about this. Hehe, I am bad!)
git push origin :remote-branch

Alright, only the last person is real.


By now, you should've known Linus Torvalds did push Linux kernel source to GitHub. I wonder if that's due to the breach.

But someone has really plenty of free time...



I bet that stevejobs is the same person.

Probably one day ago, Linus pushed some code about diving logging machine stuff. And that repo already got a lot of attention in last than 24 hours.

A couple of pull requests for just simple typos, upto 3 chars change, really? You guys really need to get his attention like that?

Please, if that's a common program, well I won't say a word. Diving? seriously, you don't even own a machine. Hell, you might not even know how to swim.

It must be FE.


I had noticed those blue dots, but never got to understand what they mean. I opened one with blue dot and one without, I compared the two pages and I still didn't find an answer. I read GitHub's help, but nothing relates to my question.

So, I fired up FireBug and read the class. Luckily, GitHub web developer gave it a meaningful name instead of something like blue-dot.

Sometimes, RTFM doesn't work and you don't want to post a question like this, then you got to get creative. :)

I created a project on github for mirroring my project on Google Code. I am new to git, so maybe there is a better way to do this.

First clone the Subversion repository and push to the Git:
git svn clone https://foo.googlecode.com/svn/ git-foo
cd git-foo
git remote add git-foo git@github.com:username/foo.git
git push git-foo master
After committing in the Subversion repository, run
cd /path/to/git-foo
git svn fetch
git svn rebase
git push git-foo master