I’ve started two new categories.
quickie. I am doing a new experiment of writing a blog post of every new or old (which I haven’t documented) I do while I am working on some project.
loud mouthis for that. But I don’t always like to explain things deep. For those times I am starting
quickie, which represents posts which just get stuff done, without explaining much; basically just a dump of the steps I took to solve something. Here’s first post that belongs to both these categories.
I tried a Chrome extension I ran into on reddit. It runs mitm proxy behind the screen. Then at an occasion, I had to run a proxy for my work purposes, but I found port 8080 is already taken. It turned out tamper keep mitm proxy running even when it’s disabled (not the extension but through the switch given in tamper). This is how I found out which application was using port 8080.
Emacs is addictive. You get addicted to it. Addicted to its power, to its flexibility, and if nothing else, it’s keyboard shortcuts. This addiction result in browser extensions like firemacs ), (you should definitely try it if you are an emacs user), which adds emacs shortcuts to Firefox (another awesome piece of technology).
So here’s my setup for using Emacs as a web browser.
Addon-sdk do makes things easier but the workflow is still not as straightforward as that of developing Chrome extensions. In chrome, we can load unpackaged extensions which are just folders containing a simple HTML app and a manifest.json. In case of Firefox addons, we need to first
- build a firefox extension from within the folder containing the code with ‘cfx xpi’ (command provided by addon-sdk)
- then run a Firefox instance with ‘cfx run’
gross right? It is indeed gross.
To make things simpler, there’s an addon in Firefox marketplace called ’auto-installer’ which allow us to install addons on the fly. This is highly recommended if you are going to develop a firefox addon.
Here’s a great tutorial on Firefox Developers Network for installing and using addon-sdk.
So when developing a new Firefox addon, things should go in a flow similar to this.
Install Auto-installer addon in FirefoxThis addon allow pushing the addon we are developing to Firefox on the fly, without the need to do something like ‘cfx run’ over and over again.
- It need us to build the addon (cfx xpi), and send it inside a HTTP POST request to localhost:8888
- It then reinstall the addon on the running Firefox instance
- It identifies the addon by its ‘id’ we define in ‘package.json’ file. So if we change the ‘id’ there, a new copy of our addon will get installed along with previously installed file.
How to use
- Install auto-installer on a Firefox instance (may be with a different profile than your default profile (firefox -ProfileManager))
- Build the addon
- Post it to localhost:8888. e.g with
wget –post-file=myAddon.xpi http://localhost:8888/
while true ; do cfx xpi ; wget –post-file=codesy.xpi http://localhost:8888/ ; sleep 5 ; doneAbove command builds a Firefox xpi addon from our source code every 5 seconds, and push it to the Firefox instance. It’s annoying in its own right.
Install ’compile-bookmarks’ in EmacsThis package allow keeping ‘compile’ commands like bookmarks, and executing them with keyboard shortcuts. It’s more useful than one might think at first. I do all sort of tasks as compile-commands in Emacs like running unit-tests.
Create a bookmark with a compile command like following:
/path/to/firefox-addon-sdk/bin/cfx xpi && wget –post-file=myAddon.xpi http://localhost:8888/When we provide complete path of the ‘cfx’ command, we don’t need to activate the ‘virtualenv’.
You can do this by
- run ‘compile’ function (M-x compile)
- execute above mentioned command from mini-buffer
- Select ‘add’ from ‘compile’ menu. The command you used previously for compiling will appear there, select it
- It will then prompt in mini-buffer for a key to use for compiling with above command
- Choose whichever seem right to you. I have chosen ‘f’ for this.
This was the workflow I came up with developing my one firefox addon. I would love to hear how experts do things. If you have time, please tell in comments your way of doing things.
So as we discussed in a previous post, there are many names for a commit (noun) in git. We may call it a branch, a tag, or just a commit, they are just different ways of accessing a commit.
So, here’s an incomplete list of different ways in which we can access a commit in git.
A quick go through to the GNU/Linux boot processThis post talks (quickly) about how a typical Linux (PC) system boots. I’ll try avoiding much technical terms. It’ll be a quick walk without diving much deeper.
The booting process of a system involves several steps.
When the computer first powers up, the code in its ROM is executed. This code generally called the firmware has some knowledge of the system hardware. On PCs this initial boot code is generally called the BIOS (Basic Input/Output System). A PC can have several BIOS levels for machine itself, graphic cards, network cards etc. In the context of booting, the BIOS generally perform two operations:
- It figures out which device to boot from
- And loads a program from the bootable sector from bootable device which tell the secondary boot loader to load
This post is actually the by-product of my research for another post about git (.git/ actually). I was so much astonished by the amount of myths about complexity of git system removed from my mind, that I decided to make it the today’s post itself. To me the git system appears much simple now than yesterday.
CommitCommit is the central piece of the git system. The git world is simply a collection of commit objects, each of which hold a tree, which hold references to other trees and blobs. The branches, the tags, the HEAD are just fancy aliases for commits (more on these in some other post (next may be)).
A commit is basically the snapshot of present working tree. I will spare the details for a future post (it’s worth it).
Let’s now discuss what this post is about. Revealing the secrets involved in every git users ritual of ‘commit’ing, and performing a commit manually.
Here is a list of cool things I could figure out to be done with netcat. I am sure there are more my puny brain couldn’t discover. Hugs and kisses for all (females) who will tell ‘em in comments.
How to undo the last Git commit?There are two scenarios in this case, and hence two ways to achieve our goal.
Hard Reset - Completely undo the last commit and all the changes it made.
git reset –hard HEAD~1Imagine the state of the tree is as following: