GitHub Text Search Chrome Extension

icon128Hi,

recentely I’ve the need to search code in some repositories hosted by GitHub but I don’t want to clone them and search in it using grep or similar. The fact is that the code is already in front of my eyes (on GitHub repository’s page) so I thought that it will be usefull (at least for me) to have some utility to search code or text directly on current repo. Well, long story short I’ve wrote a Chrome extension called “Github Text Search” which add a search bar on repository’s page which allow the user to search some text, the matches are listed as file names.

screenshot_ext_2

Due the fact that it use GitHub API there these limitations:

  • the search can be done only on master branch
  • do not support forks.

The source code is available on GitHub at this link. instead this is the link to the extension.

 

Annunci
Pubblicato in Uncategorized | Lascia un commento

GitHub Battle is reborn

Some weeks ago I’ve restarted an old (about 3 years now) project called github-battle (you can find here the old article about it).

This project only had a client side in JS which makes some ajax request to github API, now I’ve added a back-end part which stores the fights and compute stats about github users.

You can try it clicking here.

 

Bye

Pubblicato in Uncategorized | Lascia un commento

Job offer and recruiter

In the last 2 years I received e-mail from recruiters who wants offer me a job position. Unfortunately I did reject almost 90% of them before begin the interview phase and I want to explain here why I did that.

Wrong match profile

If  you contact me by e-mail or worst by phone saying “I saw your profile on Linkedin, or your resume on your site, and it is perfect for this position…” and the 70% (or none, it is happened) of required skills do not match my profile… well you’re wasting my time.
If you’re an external recruiter (or head hunter) and you do this you’re loosing  credibility and probably I will be more prepared to reject you in the future. I understand that more candidates you give to the company higher is the probability that one of them will be hired but if I was the company who ask you to find some candidates and you give me  these kind of candidates well I will no happy too.

Required skills in everything

One of the last positions was for a web developer. The required skills begin well each of them was about the field, but after a while starts to compare:

  • experience with app mobile
  • machine learning
  • Golang
  • C#
  • SDK social network (Facebook, Twitter, Linkedin) and Google Services
  • configuration and maintenance of server Linux

To me it seems a quite wide required skills for a “web developer” position. Please specify a set of skill which match the position you’re looking for.

Choose carefully third party recruiting web service

Some platforms for recruiting are bad, really bad or may happens that they are used in a wrong way. I’m registered in some of them and may happens that the procedure of selecting is disputable and discouraging. In the last 3 months from one of them I received about 4 application’s request, the procedure consist about a set of few questions like “Set below your Python level” and 3 radio button with “low, medium, high” or “Do you know Django? [Y/N]” and even worst questions. For each “correct” answer you gain 1 point and for wrong one you loose a point. Please do not use them or at least try to write some good question, not generic ones.

These too are the main reasons which cause my reject, there are others but I’d like to put them as list of advices about what and how write in a job announce.

1 – Please write the range of salary for the position, specially if you’re looking for an employee with high skills level.

2 – Avoid to say “Fresh new super tech ninja startup” and try to describes the company.

3 – Write a typical day of work for the position.

4 – Avoid to say “If you have a great passion for new technologies and looking for place where you can use them” if the required skills are PHP 5.X, CSS, HTML.

5 – The fact you have videogames, bowling, free beer, barbecue on the beach during weekend etc do not convince me.

6 – Saying “We’re looking for person who sacrifices his life to the company, like work overtime etc” means you’re looking for slaves not employees.

7 – Write the technologies used in the company.

8 – Do not hide the company name.

These are just some advices, please feel free to use them.

 

 

 

 

Pubblicato in Uncategorized | Lascia un commento

Hacktoberfest 2016

hacktoberSome days ago ended Hacktoberfest 2016 an event created by DigitalOcean in partnership with GitHub.  The event is a month-long celebration of open source software where  the people are invited to contribute towards issues on projects hosted on GitHub in order to help move the them forward. The contributes can be bug fixes and documentation updates. Who contributes with 4 pull-request win a free, limited edition Hacktoberfest T-shirt.

Unfortunately I win just the sticker pack (like the other participants), but I like to participate to it. I always think that is important to participate on open sourced project but usually I do very few things about it… probably due of my bad time management, too many ideas that I want to do and sometimes the need to just relax on couch or go around somewhere (if I remember correctly it is called “live”). Anyway I really appreciated the initiative and I will participate again the next year, hopefully to win the T-shirt :).

[UPDATE 11/January/2017]

nor

Pubblicato in open source, programming | Contrassegnato , | 1 commento

Passing a Python callback to C++ in Cython

Hi,

in these days my work involve the porting of one of mine C++ library to Python, to accomplish this I’ve used Cython. The use of Cython is simple and very well documented but I’ve encountered a problem porting a callback from C++ to Python so I’ve decided to write down a post about my problem and the solution that I’ve adopted.

C++ Library

The library that I’ve wrote is a client library used to communicate with a server, it provide a class with a very poor API, the meaning of this library is out of scope but below you can find the basic actions provided by the library.

class ClientLibrary{
    ClientLibrary();
    init(std::function<void(const unsigned int &, 
                            const std::string &)> log = nullptr,
         unsigned int log_level=NORMAL_LVL);
    connect(const std::string &ip, unsigned int port);
    disconnect();
    ...  // others methods
};

As said it has a simple API, just one function has need of explanation, the init(). This method initializes the library (or class) itself, it accept a function pointer and an unsigned int. The first parameter is used in order to let the user specify its own  custom log method and the second to set the level of the log in which is interested.

Let the user to specify its own log method is important, in this way it can save it on file or handle some casuistry in some way. The constraint is that the function specified must accept as first parameter an unsigned int and for second parameter a string, these are the log level  and log message.

Problem

The problem is that the porting in Python use Python code (well… kinda obvious) which C++ library don’t understand. In fact even if you use Cython some where you call the C++ code of the original library, in this case it means that when the user pass the callback in Python the C++ part get angry because it expects a function pointer.

Solution

To avoid it I’ve created a  Men In the Middle function with the same interface expected from a log callback function in C++ which call the Python callback.

# create a MIM function for log callback
# it has the same interface expected from C++ version
cdef void log_mim(unsigned int log_level, const string message)
    pylog_cb(log_level, message)

# Python class
cdef class PyClient:
    ....
    def init(self, log_cb=None, log_lvl=0):

        if log_cb is not None:
            # Python 2.x support
            if not callable(log_cb):
                raise TypeError("""The first parameter MUST
                                   be a function.""")
            # store the Python callback on global variable
            # pylog_cb
            global pylog_cb
            pylog_cb = log_cb
        return self.client_ptr.init(log_mim, log_lvl)

The init method accept a callback  log_cb and the log level log_lvl, the first is stored on the global variable pylog_cb. At the end it will call the C++ init passing the function log_mim. When the C++ code will call the callback log_mim (C++ function pointer) it will call the Python pylog_cb.

Conclusion

This solution to “callback problem” works pretty well, the MIM function allows to avoid the incompatibility between the 2 languages.

On PyClient is missing all the source code about the allocation/deallocation of the object and how to link Python and C++ code cause it is beyond the scope of the post.

Pubblicato in programming | Contrassegnato , , , | 2 commenti

Linkedin is not Facebook

lnotFHi,
today I’ve received the N e-mail from Linkedin which says that someone on my Linkedin network has confirmed or “added” a skill on my profile even if he/she doesn’t know the field in which I work and/or doesn’t know anything about my skill. so I’ve decided to write down a post about how the people is using Linkedin. First of all Linkedin is not Facebook hence stop adding useless post which not regards your work, field, hobby or something that has any sense; I don’t belive that a video with kittens has something to do with your job unless you’re a vet. As others social networks which makes use of reputation (that will be ‘like’, karma points and so on ) on Linkedin happens that the people share the ‘skill validation’ between them, a user endorses the skill of another in order to have a skill validation too. This kind of behavior do not help Linkedin and its users because the skill endorsement lost its value… ok in my work (sw developer) I don’t belive in something like ‘skill validation’ on social network anyway, in fact I prefer to see the source code or something else (documentation, tests etc) that give to me the idea of the capabilities of a person. For these reasons I don’t accept the endorsement of persons that don’t have the skill to understand my work (even if they don’t do my same job they can be a great developer even if they do it for hobby) or that haven’t see one single line of my code or haven’t worked with me (for hobby or job). I guess that everyone should at least ask himself  if the ‘skill validation’ of someone has any sense and not try to collect as many as he can ( we’re not playing to Pokemon so we can’t have to ‘catch em all’). So be honest with yourself and accept only the endorsement from people who you know and make honest endorsements.

Pubblicato in Uncategorized | Contrassegnato , | Lascia un commento

An unexpected Alibaba

logo
Hi,

today a friends of mine suggests me to make a challenge between Google and Alibaba on my site GitHub Battle. Well long story short the challenge was won by Alibaba; OK I admit that the formula used to compute the score isn’t perfect and some parameters may missing but anyway it has highlighted the fact that Alibaba is a great contributor about open source and has a great number of repositories. This is an unexpected event, well at least for me, and this made me think that GitHub Battle can be used in some way to discover some particular/funny event. So until I make some improvements I will ask you to notify me if you find something that seems interesting while you are using GitHub Battle :). At the end of this post you can find a screenshot about the “challenge” between Google and Alibaba.
Bye

GoogleVSAlibaba

Pubblicato in Uncategorized | Contrassegnato , , | 1 commento

GitHub Battle

logo
Hi,

some time ago I’ve seen the site Github Awards. This site shows the rank of GitHub’s users, you just need to write the username of a user and it shows his world, national and city ranks for each programming languages that he used. I’ve played a little with it, looking my ranks and the ones of my friends so after a while I’ve started to thought to see who, between me and my friends, have the highest rank. Well from that idea I came up with a site which allows anyone to make challenge 2 GitHub’s users and see which one has the highest score. The way in which the score is computed is quite simple and different from the one used in GitHub Awards. The site compute the score for each repository using the following formula:

repo_score = stars + 1.5*forks + 0.2*watchers

the scores are grouped by programming languages and the total score is the sum of all programming languages score.
For which is interested to play the site is available at GitHub Battle instead for which wants to contribute can find the repository on GitHub.

Pubblicato in programming, Projects | Contrassegnato , | 2 commenti

SCTR a tool for reporting tagged comments

Hi,

today I’ll introduce you my new project called SCTR (Source Code Tags Report). This project is born, as usual, due my laziness and bad memory. In my current job I work both in front-end and back-end part, each of them composed by different part i.e. different services written in C++ (for back-end) or JS/HTML (for front-end). So I’m moving frequently, really frequently, in different files due the current priority, so to not forget what I should do I put comments with tags (Wikipedia). May happen that some TODO, FIXME etc will be forgotten in the mass of code because I’ve changed where I’m working on and/or, as I said before, due my bad memory. Thus my code have, for my sake, comments with some tags but I didn’t remember in which files they are. Long story short, to avoid this I’ve write a script in Python which parse a file or a directory searching for tags and reporting them in a file. For readiness the report is a HTML file which shows for each files there are the comments body grouped by tag name as showed in the example below.

report_example

At the current version the script recognize TODO, NOTE, XXX and FIXME tags and .cpp, .h, .py and .js file. Anyway it is easily customizable, in fact you can add your own tags and new file type (with its own comments style). Everything is explained in the README file.

You can download SCTR on GitHub.

Note: SCTR was used to collect the comments of SCTR itself.

Pubblicato in programming, Projects | Contrassegnato , | 2 commenti

Italians do it not so bad

Here in Italy may happens to hear people say that to do something good, in the world of IT, you MUST go away from Italy or at least go in a big city like Milan, Rome, Turin etc.
Well I don’t think so because in the world of IT distances do not exist or perhaps are resized. I think that if you have a good idea you can do it in your own home, thanks to the NET it can be reached everywhere and if it is an interesting project collect a set of fan/contributors/etc. In order to discredit this common belif I’ve decided to write about some italian people who are part of that set. Obviously they are not the only ones so I would appreciate all your reporting.

Salvatore Sanfilippo (antirez)

Salvatore live in Sicily and it has created Redis (REmote DIctionary Server) the most popular key-value store. I heard about him watching Hacking Italia, a news collector similar to Hacker News. I suggest to take a look to his blog, there you can find very interesting post about Redis evolution and something else.

Luigi Rizzo

I was lucky to have had him as a university professor and followed his course. I think that has worked in almost every field related to IT, his knowledge is impressive and even if many will turn up their nose reading the following I really appreciated its course and I find the topics he mentioned well-treated, complete and not at all dated. He did a lot of things to talk about all; here I report the last one, a framework for high speed packet I/O called netmap. For more information take a look to his personal page.

Marco d’Itri

It’s very active and well known in the Debian world, many people know him thanks to his whois client that is used as default in every Linux distribution. He’s the maintainer of about 20 debian package.

You can follow his twitters here.

You can find an article about the first 15 years of his whois client here, look for Fri, 3 Oct 2014.

Luca Deri

He is a reasercher of IIT-CNR of Pisa and he’s the creator of ntop a software for network monitoring that shows network usage in a way similar to what top does. Take a look even to his personal page.

Vincenzo Colucci

He’s an Android developer who lives, and works, in Manfredonia (his hometown). He developed SmartLauncher, a famous launcher for Android phones, that counts about 10-50 milions of download. You can see here a video made by those of Google which tells about his story.

NOTE: the title of this post wants to be a contrast about the phrase “Italian do it better” and the common belief that I mentioned above.

Pubblicato in Uncategorized | Contrassegnato | 1 commento