git-clone and post-checkout hook

I suppose you could make a custom installation – rename the hooks in …/share/git-core/templates/hooks to remove the .sample suffix. You could also make a template directory full of symlinks to a hooks directory inside the repository, (e.g. post-checkout -> ../../hooks/post-checkout). Then if the cloned repo contained that particular hook, it’d get executed. You’re right, though, … Read more

How to get selected text of any application into a windows form application

After some reading, I have found the way: Hook the double click event using something like globalmousekeyhook.codeplex.com (Optional) Save the current state of the clipboard Get The current mouse position with GetCursorPos from user32.dll Get windows based on cursor position with WindowFromPoint from user32.dll [DllImport(“user32.dll”)] public static extern IntPtr WindowFromPoint(Point lpPoint); [DllImport(“user32.dll”)] public static extern … Read more

How can I hook into Perl’s print?

There are a number of built-ins that you can override (see perlsub). However, print is one of the built-ins that doesn’t work this way. The difficulties of overriding print are detailed at this perlmonk’s thread. However, you can Create a package Tie a handle Select this handle. Now, a couple of people have given the … Read more

how could I intercept linux sys calls?

Why can’t you / don’t want to use the LD_PRELOAD trick? Example code here: /* * File: soft_atimes.c * Author: D.J. Capelis * * Compile: * gcc -fPIC -c -o soft_atimes.o soft_atimes.c * gcc -shared -o soft_atimes.so soft_atimes.o -ldl * * Use: * LD_PRELOAD=”./soft_atimes.so” command * * Copyright 2007 Regents of the University of California … Read more

Best way to allow plugins for a PHP application

You could use an Observer pattern. A simple functional way to accomplish this: <?php /** Plugin system **/ $listeners = array(); /* Create an entry point for plugins */ function hook() { global $listeners; $num_args = func_num_args(); $args = func_get_args(); if($num_args < 2) trigger_error(“Insufficient arguments”, E_USER_ERROR); // Hook name should always be first argument $hook_name … Read more

Java shutdown hook

The JVM can shutdown in either an orderly or abrupt manner. A shutdown hook runs for an orderly shutdown: when the last normal thread terminates, someone calls System.exit or by other platform specific means (such as typing Ctrl-C). Shutdown hooks will not run for an abrupt shutdown of the JVM. As you are pressing the … Read more

Is there any git hook for pull?

The githooks man page is a complete list of hooks. If it’s not on there, it doesn’t exist. That said, there is a post-merge hook, and all pulls include a merge, though not all merges are pulls. It’s run after merges, and can’t affect the outcome. It never gets executed if there were conflicts; you’d … Read more