Updating Email ID and Author Name from multiple commits in Git


Multiple Commits:

git filter-branch --commit-filter '
        if [ "$GIT_COMMITTER_NAME" = "" ];
        then
                GIT_COMMITTER_NAME="";
                GIT_AUTHOR_NAME="";
                GIT_COMMITTER_EMAIL="";
                GIT_AUTHOR_EMAIL="";
                git commit-tree "$@";
        else
                git commit-tree "$@";
        fi' HEAD

Single Commit:

To update the author to a specified name [The committer will be set to your configured user in git config user.name and git config user.email]

git commit --amend --author "New Author Name <email@address.com>"

To set both the author and the committer:

git -c user.name="New Author Name" -c user.email=email@address.com commit \
--amend --reset-author

Interactive Rebase

git rebase -i -p <some HEAD before all of your bad commits>

Then mark all of your bad commits as “edit” in the rebase file. If you also want to change your first commit, you have to manually add it as first line in the rebase file (follow the format of the other lines). Then, when git asks you to amend each commit, do

git commit --amend --author "New Author Name <email@address.com>"

edit or just close the editor that opens, and then do

git rebase --continue

to continue the rebase.

You could skip opening the editor altogether here by appending –no-edit so that the command will be:

git commit --amend --author "New Author Name <email@address.com>" --no-edit && \
git rebase --continue

If there are any merge commits between the current HEAD and your , then git rebase will flatten them (if you use GitHub pull requests, there are going to be a ton of merge commits in your history). This can very often lead to very different history (as duplicate changes may be “rebased out”), and in the worst case, it can lead to git rebase asking you to resolve difficult merge conflicts (which were likely already resolved in the merge commits). The solution is to use the -p flag to git rebase, which will preserve the merge structure of your history. The manpage for git rebase warns that using -p and -i can lead to issues, but in the BUGS section it says “Editing commits and rewording their commit messages should work fine.”

Reference:

Advertisements

Working around untrusted certificate errors in Express JS


A few very common fatal errors thrown by the request module for express while trying to access data from self-signed web servers are Error: DEPTH_ZERO_SELF_SIGNED_CERT and UNABLE_TO_VERIFY_LEAF_SIGNATURE

This is because of https://github.com/nodejs/node-v0.x-archive/pull/4023 which mandates NodeJS to validate a server’s certificate by default, which needless to say is how things should be in a production environment.

However, more often than none we tend to use self-signed SSL certificates in our development environments or even within internal networks.

Thankfully for such brain-wracking moments, two particular flags come to our rescue. Enter strictSSL and rejectUnauthorized. The way I personally like to use these flags, is to set defaults within my development environments as follows to bypass SSL validation hence, saving the day! 🙂

var request = require('request').defaults({
    strictSSL: false,
    rejectUnauthorized: false
 });

Please do note, that I do not recommend that you ever try this on your production systems without understanding the true implications of what disabling strictSSL and rejectUnauthorized means for you node server. By disabling these, you are essentially telling your server to skip validation of the requested server’s identity, which leaves your application in quite a vulnerable position.

Rebooting the Bugsmith’s Blog


It’s been a long long time since I last posted in this space. I guess I had been a bit too caught up with life and had been overly focused on my job.

Recently, I realized that I have become quite dormant in the open source communities, and it has been quite some time since I made a worthwhile commit on GitHub / Pagure / BitBucket/etc. My GitHub streak now looks mostly empty which means I have been lazy for over a year now.

So, enough with the slacking around for so long. It’s time to reboot the Bugsmith and get back to the groove of things.

It’s time to draw a line and balance out all the imbalances in my current everyday life. This means fixing my office work schedule, being a bit conscious about my health, and most importantly, getting back to doing something worthwhile with my life.

So, here’s the plan:-

  1. I’ll start posting more often about anything and everything.
  2. I’m gonna start sharing as much of my everyday learning related to tech and non-tech using this blog as a medium.
  3. Finish up all of my pending work [mostly personal stuff which I have been ignoring for a long time now].
  4. Get back to contributing more pro-actively to Open Source projects which I find interesting.
  5. Get back to attending tech-meetups in my vicinity and beyond.
  6. Well basically, get my stuff together and get back to being awesome yet again. 😉

Let’s see how I manage to cope up with my self-expectations! 🙂

Using Vim to generate HTML output of code


This is an interesting bit that I learnt about from an email in a mailing list by James Pryor.

To generate html output for code within a shell script you can use:

vim myscript.sh '+syntax on' '+ set nu' '+set background=light' +TOhtml '+w myscript.html' '+qall!'
If you don’t want numbers and need a dark background you can use:
vim myscript.sh '+syntax on' '+ set nonu' '+set background=dark' +TOhtml '+w myscript.html' '+qall!'

Installing EditorConfig on Sublime Text


To install Editor Config on Sublime Text all you need to do is to follow the following steps:-
  1. Go the Preferences tab -> Package Control.
  2. Select Install Package from the drop down menu.
  3. Wait for the list to load, once it loads it will show you a list of packages.
  4. Now, type in EditorConfig and select the highlighted option.

To confirm that Editor Config is installed correctly on your Sublime Text instance you can go to Preferences -> Browse Packages. If installed correctly you should be able to see an EditorConfig directory present in the Packages directory.

That’s it! Enjoy! 🙂

Installing Sublime Text 3 on RHEL / Fedora


Here’s another three step guide to installing Sublime Text 3 on RHEL 6,7 / Fedora 18, 19, 20:-

  1. Download the installation script from the following gist.
    https://gist.github.com/sayak-sarkar/11b039f398ddcae88139
  2. Extract it to your home directory [or anywhere you like].
    $tar -xvf gist11b039f398ddcae88139-e339084ef22e956ea6ef8d04f8279ca70772f534.tar.gz
  3. Open your terminal (preferably as super user), navigate to your home directory and execute the shell script.
     #./sublime-text-3.sh

Voila!! You now have Sublime Text 3 installed on your machine. You may run it from the terminal or via the alt+f2 shortcut by simply typing in “sublime”.

Based upon my previous post on How to install Sublime Text 3 on Fedora. 😉

Enjoy!! 🙂

Creating scrollable Charts using Angular-Kendo


Creating Scrollable Charts:

Horizontal scrolling of Charts is not supported out of the box in Kendo UI, however it can be achieved using a bit of custom styling.

Basic steps:

  • Set overflow: auto of the <div class="chart-wrapper">;
  • Set width of the aforementioned div;
  • Set width of the <div id="chart"> to a value higher than it’s parent div width size.

Example piece of code:

Template:

<div class="parent-container">
  <div kendo-chart k-options="line" class="chart-container">
  </div>
</div>

CSS:

.parent-container {
    overflow-y: scroll; 
    width: 1000px;
}

.chart-container {
    overflow: auto; 
    width: 2000px;
}

Installing Android on the Geeksphone Keon


Here’s a clean, clear and to the point english post on how to install Android on your Geeksphone Keon developer device:-

Android on Keon

STEPS:-

  1. If you don’t already have adb and fastboot installed on your system:-
    1. Get the packages from here.
    2. Extract the contents of the zip file and navigate to the adbfastbootmac directory [Note: This package works on macs, if you are using Linux or any other operating system, a simple online search should help you figure out how to get adb and fastboot]
  2. On your Keon go to ‘Settings’ -> ‘Device Information’ -> ‘More Information’ -> ‘Developer’. From the list of checkboxes, enable the ‘Remote debugging’ checkbox.
  3. Connect your device to your computer using the USB cable.
  4. Back on your computer’s terminal do the following:-
    1. If you are using the package mentioned above, run ‘./adb devices’
    2. You should see a device named ‘full_keon’ as a part of the output. If you don’t see it listed out there, try reconnecting your device or check whether the Remote Debugging option is enabled.
  5. Now let’s get down to the magic:-
    1. Download and store the following zip packages to you device’s SD-Card:-
      1. TWRP recovery
      2. Android ICS ROM for Keon
      3. Google Apps
      4. Additional Ring Tones
    2. Start the Keon in the fastboot mode :
      # ./adb reboot-bootloader
    3. Install the new recovery :
      # ./fastboot flash recovery TWRP-GK.img
    4. Boot the recovery :
      #./fastboot boot TWRP-GK.img
    5. On the device’s screen now tap on ‘Backup’ to create a backup of Firefox OS.
    6. Once done, tap on ‘Wipe’ → ‘Swipe to Factory Reset’.
    7. ‘Install’ (select the ROM) → ‘Add More Zips’ (select the Google Apps and Additional Ringtones zip files) → ‘Swipe to Confirm Flash’.
    8. ‘Wipe Dalvik and Cache’.
    9. Tap on ‘Reboot System’.
  6. Voila! You’ve now successfully installed Android on your Geeksphone Keon device.

NOTES:-

  1. Make sure that the device has at least 50% battery power before commencing with the process.
  2. Since the Keon has only one soft touch button on it, it is mapped to the back functionality. If you want to use all three default Android soft-buttons, the easiest way to do that would be to install the “SoftKey Enabler” app from the Android Play Store.

SWITCHING BACK TO FIREFOX OS

If you now want to switch back to Firefox OS, all you need to do now is as follows:-

  1. Turn off your device.
  2. Press the power and the volume up buttons of the Keon at the same time to boot into the Team Win Recovery image.
  3. Tap ‘Restore’ and select the backup file created earlier during the Android setup, and confirm.
  4. Once the process completes, you should be able to use Firefox OS again! 🙂

DISCLAIMER: Please note that the steps I’ve mentioned here are what I followed to try out Android on a couple of my Keons. These steps involve flashing the device, hence involve a very real risk of ending up with a bricked [dead] phone. As such, go about the process at your own risk. I’m in no way liable for any unforeseen results coming out of this process.

References:

  1. http://sys.nodo21.org/geeksphone-keon-rom
  2. http://forum.geeksphone.com/index.php?topic=5672.msg60983#msg60983

 

ReMo Council Meetup 2014


On February 2014, the Mozilla Reps Council and module Peers met for 2 days at the Mozilla Paris office to discuss the future roadmap of the Mozilla Reps program. The idea was to discuss and solidify plans, vision and goals of the Mozilla Reps program in general to align with Mozilla’s organizational goals around growing the community towards the Million Mozillian goal.

The Mozilla Reps council was joined by William Reynolds (Community Tools, including reps.mozilla.org), Konstantina Papadea (Budget and Swag), Michelle Thorne (Foundation), Marcia Knous (QA), and Rosana Ardila (SUMO) as guests for the bi-annual meetup to provide their feedback on the discussions and help solidify the roadmap for the council in the upcoming year.

Group Picture

Day 1

The main topic of discussion for day one of the meetup was:

How can we improve the Reps program to better enable Mozilla Communities that have impact?

The two primary topic areas on day one were program structure / goals, and leadership. We broke into sub-groups to come up with the bottlenecks and problems in these areas. Solutions were kept aside for the upcoming sessions. Items were grouped into three different categories that we felt caught all we wanted to capture – Council and Peers, Mentors, Reps.

Apart from these we also had discussions on a larger spectrum of topics. Michelle talked about Teach The Web/Webmaker plans for the year and how Reps can support it. Here we also had a discussion about events in general and what would be the best way forward in supporting event organizers worldwide.

Tristan Nitot came in to talk about TRIBE and personal development. Kate Naszradi dialed in really early California time to give us an update on the fast growing Firefox Student Ambassadors Program. Then Mary Colvig and David Boswell joined to discuss the topic ‘Enable Communities that have Impact’, aka One Million Mozillians. How we are going to scale by 10x in 2014.

Day 2

On the second day, we basically threw out the written schedule, and decided to hack around a bit. The general mood of the room was to find solutions to the issues we identified on day one and start implementing them.

In the meanwhile, Pete Scanlon dropped in for a discussion on Engagement, the team’s role in 2014 Mozilla goals, and how Reps fit in and can make an impact. We also had a few more discussions on some other important topics that came up such as the Reps application process and how it can be improved.

Discussion with Pete Scanlon

Summary

The summary of what was discussed over the weekend can be expressed in a single line as:-

The goal for the ReMo program is that Mozilla Reps across the globe would be more engaged, empowered and enabled in the year 2014.

%d bloggers like this: