hook

A puzzle about hook arm function, by modify ELF file

我是研究僧i 提交于 2019-12-20 04:23:22
问题 I want to hook a function by modify elf file's .text binary, my mean is replace an instruction like 'bl xxxx' with 'bl yyyy', the 'yyyy' is point to an padding area in elf file. After jump, I save the registers and call dlopen&dlsym to get new function's addr of another lib, call it, then restore the registers and jump back to 'xxxx'. It is not very hard, and I have almost successful except for a problem: I cannot use 64-bits var in my hook function. The int type is no problem, but when I

Git post-receive hook acts differently to shell

自作多情 提交于 2019-12-20 03:08:01
问题 I'm trying to setup a git repo on my live server to automatically update a subdomain on receive. Using this guide http://toroid.org/ams/git-website-howto. hooks/post-receive #!/bin/sh pwd git checkout -f config [core] repositoryformatversion = 0 filemode = true bare = false worktree = /var/www/vhosts/domain.com/subdomains/staging/httpdocs [receive] denycurrentbranch = ignore If I run git checkout -f in /var/git/domain.com.git/ it works, the subdomain is updated. However, when I push I get the

How does this pre-commit hook fix trailing whitespace?

穿精又带淫゛_ 提交于 2019-12-20 02:43:27
问题 What is going on in this pre-commit hook? I thought changing files would cause them to be restaged. #!/bin/sh # # A git hook script to find and fix trailing whitespace # in your commits. Bypass it with the --no-verify option # to git-commit # if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then against=HEAD else # Initial commit: diff against an empty tree object against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi # Find files with trailing whitespace for FILE in `exec git diff-index --check

Function that remove specific lambda from a hook in Emacs

对着背影说爱祢 提交于 2019-12-20 02:07:47
问题 I found this macro, to run code for specific project path: (defmacro project-specifics (name &rest body) `(progn (add-hook 'find-file-hook (lambda () (when (string-match-p ,name (buffer-file-name)) ,@body))) (add-hook 'dired-after-readin-hook (lambda () (when (string-match-p ,name (dired-current-directory)) ,@body))))) and I use it: (project-specifics "projects/test" (message "z")) And I work on modification that will remove prevoius lambda from the hook, so far I have helper functions (defun

Function that remove specific lambda from a hook in Emacs

久未见 提交于 2019-12-20 02:06:30
问题 I found this macro, to run code for specific project path: (defmacro project-specifics (name &rest body) `(progn (add-hook 'find-file-hook (lambda () (when (string-match-p ,name (buffer-file-name)) ,@body))) (add-hook 'dired-after-readin-hook (lambda () (when (string-match-p ,name (dired-current-directory)) ,@body))))) and I use it: (project-specifics "projects/test" (message "z")) And I work on modification that will remove prevoius lambda from the hook, so far I have helper functions (defun

how to format commit message for some people in git hook?

时间秒杀一切 提交于 2019-12-19 11:56:22
问题 people should add bug ID in commit message in some format,such as [BUG33] [review leader=...] ... and not every committer must have to follow this formula,i mean scm can write free in commit message. i have searched that commit-msg hook may help to implement it. any one can git me some similar hook examples 回答1: The book progit has an excellent example of these, both server-side and client-side. You can find a few examples here. One example taken from that link and adapted to your commit

Calling Block multiple times in Cucumber Around Hook (Ruby)

那年仲夏 提交于 2019-12-19 10:42:16
问题 I'm trying to run a scenario several (30) times in order to get a nice statistical sample. However the block is only executing once; each subsequent time results in the scenario being called and not executing (although it says that the scenario did successfully complete with a time of around 5 ms). Around('@mass_benchmark') do |scenario, block| $seconds_taken = "SECONDS TAKEN NOT SET" @time_array = [] 30.times do before_hook(scenario) block.call after_hook(scenario) @time_array << $seconds

Send combination of keystrokes to background window

好久不见. 提交于 2019-12-19 06:26:09
问题 After a lot of research on Stackoverflow and google, it seems that it's difficult to send a combination of keystroke to a background window using it's handle. For example, I want to send CTRL + F. It seems that Sendmessage doesn't work, and sendinput isn't effective because the window needs the focus. So the my last thought is about hooking: is there anyway to use that way to send combination? 回答1: Ok I found a workaround, but it doesn't work for all applications. Otherwise, it works with

WordPress hooks for executing right before any action or page loading

妖精的绣舞 提交于 2019-12-19 05:59:11
问题 I'm quite new to WP. Task is to develop a plugin for oauth authentication on one of not popular openID providers. I did the same for CodeIgniter project, but WP is a CMS and is little bit complex for me to understand. In Codeigniter i check authorisation before each action. In WP i need a hook which uses for it... before each page printing, or maybe.. it would be right to say before each action in terms of frameworks. What is this hook's name? 回答1: A list of all available hooks can be found

Thread hook procedure is no longer called after pressing Tab several times. Why?

两盒软妹~` 提交于 2019-12-19 03:49:20
问题 I installed a thread-specific windows hook to monitor messages sent to WndProc. It worked at first. However, after I pressed Tab about 19 times to move focus around a form, my hook callback is nolonger called. This happened regaless of whether I pressed Tab quickly or slowly. Can anybody explain what is really going on? Below is the code I wrote. I tested it on Windows 7 64 bit. using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using System.Runtime