Skip to content

Instantly share code, notes, and snippets.

View shdown's full-sized avatar

Victor Krapivensky shdown

View GitHub Profile
size_t l = 0, r = 0;
for (size_t i = 1; i < n; ++i) {
size_t val = 0;
if (i < r)
val = min(r - i, z[i - l]);
while (i + val < n && s[val] == s[i + val])
++val;
z[i] = val;
if (r < i + val) {
r = i + val;

GSoC 2017 Work Product Submission

What is done

  • Modified strace to be able to implement a pull-style syscall tracing API for Lua scripting.
  • Added support for Lua scripting, implemented a pull-style C API. Lua scripts can select syscalls they want to be notified about; inspect PID of the traced process, syscall arguments, and return value (on syscall
# limitation: names of variables to return result to can not start with an underscore.
«() {
local -i _i=1
while [[ ${!_i} != » ]]; do
declare -n _${_i}=${!_i}
(( ++_i ))
done
"${@:$[_i+1]}"
}