Discover how AI is transforming the roles of coders in the IT field. From automating routine tasks to creating new opportunities, explore th

seen from Malaysia
seen from United States
seen from China
seen from China

seen from United States
seen from United States
seen from Russia
seen from United States
seen from United States
seen from South Korea
seen from United States
seen from China
seen from United Arab Emirates

seen from United States
seen from United States
seen from United States
seen from United States
seen from China

seen from Malaysia
seen from Germany
Discover how AI is transforming the roles of coders in the IT field. From automating routine tasks to creating new opportunities, explore th
The 6 best tips for writing compelling tech stories Continue reading on The Writing Cooperative »
Written by Jean-marc Buchert
More Delightful Unboxing Videos: http://puppetshed.com The latest innovation in personal computing has arrived, and this next killer tablet, laptop combo represents the latest and greatest thinking in this space. We've managed to smuggle this footage out of a secure bunker in Voltenstad's red zone and bring it directly to you! Sadly this effort costed many, many lives.. mostly due to personal lifestyle choices consisting of poor diet and exercise, but we're pretty sure one guy died from electrocution after powering on the new tablet.
Generate a HTML diff from arbitrary git revisions.
Last week I had to code up a quick demo so the boss has something to show the client. Despite my efforts to do as much TDD as I can so the codebase's super solid, I did not have enough time to deliver. Thus a `demo` branch was born so I could contain those changes away from `develop`. And so the demo went well, time to get those changes back into the main line with tests. I wanted a good way to show the changes between branches but there were not many good options besides running git diff in another pane in `tmux`. Instead I want it to display in a window next to me with some diff highlighting that I can scroll around with the mouse. Maybe all contained in a single file. After a quick research I found this [diff2html question on StackOverflow](http://stackoverflow.com/questions/641055/diff-to-html-diff2html-program) and discovered that I could use [pygmentize](http://pygments.org/docs/cmdline/) to generate a highlighted diff file in html which is exactly what I wanted. ### TL;DR / Steps * Install `pygments` with (assuming you already have python's [`pip`](http://www.pip-installer.org/en/latest/installing.html) installed) ``` $ pip install pygments ``` * Runs a `diff` for the revisions that you wanted: ``` $ git checkout demo $ git diff develop ``` * Pipes it into `pygmentize` with the `-l diff -f html` option to generate a HTML view of the diff. ``` $ git diff develop | pygmentize -l diff -f html -O full -o diff_demo_develop.html ``` * Opens `diff_demo_develop.html` in your browser. I think this might comes in handy sometimes. Thus the blog.
Send a git repository to another machine via netcat
Such as a virtual machine running on your local network or a friend you met at a coffee shop looking to clone your repository.
And sometimes git-serve is a bit too complicated.
First of all, bundle your repository.
cd ~/my_repo_folder
git bundle create myrepo.bundle master
The bundle command packs your repository into one nice tranferrable file.
Next, on your friend's machine, open up a port with netcat and writes anything that comes through to a file.
nc -v -l 127.0.0.1 -p 777 > friend_repo.bundle
The -l starts a listening (server) mode. The -v just makes it print stuff so you know when a connection is going through (or not.)
Then send it over, again, using netcat.
nc -v 192.168.1.77 777 < myrepo.bundle
On your friend's machine, ensure you have something that's not a zero-byte file. Then you can just clone the bundle file normally as if it were a single repository:
git clone friend_repo.bundle friend_repo -b master
The -b master is there to specify the initial checkout.
Other than using netcat, git bundles are also useful for:
Sending repository over email.
Or backing up.
Transferring your repository via ssh/rsync/telnet etc. (i.e. when you only have port 80 and 22 open.)
Enjoy! :-)
TODO: Package this into a shell script. :-P
Ad-hoc Git server using just the git daemon command.
First of all, if you're still using something other than Git: [Why Git is Better than X](http://whygitisbetterthanx.com/). And **Git is working fine on Windows** both using the Cygwin builds and MinGW builds (msysgit) don't believe the stupid [FUD](http://en.wikipedia.org/wiki/Fear,_uncertainty_and_doubt). Since I have to move to a new office to work off-site for a few months with a few other developers. And I couldn't just give them access to our internal Git repositories server I figured I need a local server for working. Setting up Git servers has been a PIA when I first started my company and it still is if you need authentication -- except if you're already authentication properly via SSH -- which is simply isn't the norm for most folks. But if you're a local team hacking on some cool stuff, no authentication system required, you just need a good spare machine that can boot up an OS. #### For the lazy, just add this to your `~/.gitconfig` [alias] serve-lan = !git daemon --reuseaddr --verbose --base-path=. --export-all --base-path-relaxed --enable=receive-pack ./.git ./*/.git ./*.git And issue `git serve-lan` on the machine with the central repositories. This will serve all the repositories found on the folder to the `git://` port. For the explanation of what those switches does, see the [git-daemon documentation](http://www.kernel.org/pub/software/scm/git/docs/v1.7.3/git-daemon.html). In short, they are mostly there to tell git to allow push/pull request to all repositories in the current folder. #### Otherwise just follow these steps: 1. Setup the OS. 2. Grab a [Git](http://git-scm.com/download) package and install it. 3. Add the above `[alias]` section to your `~/.gitconfig`. 4. Create a writable folder somewhere (I just use the OS Desktop) 5. Open the terminal. 6. Change to the folder 7. Create all the Git repositories you'll need. Usually you'll just need one. 8. Issue `git serve-lan` 9. You can now clone from url `git://git-machine-hostname-here/project-name.git` This translate to something like this on an old Macbook (assuming Git is installed): mkdir Repositories/project.git cd Repositories/project.git git init --bare cd .. git serve-lan And that's done, an effortless central git server for hacking stuff in .. like ... 5 minutes. **Caveat:** This is a public anyone-can-push repository. So use with care. If you want to provide read-only access, just drop the `--enable=receivepack` argument from the configuration above. Hope I didn't left out too much detail. Enjoy!