This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int | |
binary_search_first_position(int *A, int n, int target) { | |
int end[2] = { -1, n }; | |
while (end[0] + 1 < end[1]) { | |
int mid = (end[0] + end[1]) / 2; | |
int sign = (unsigned)(A[mid] - target) >> 31; | |
end[1-sign] = mid; | |
} | |
int high = end[1]; | |
if (high >= n || A[high] != target) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vim:fenc=utf-8 | |
""" | |
Python supervise | |
---------------- | |
This module provide a methods to handle runit [1]_ or daemontools [2]_ based | |
supervised services, using the control file provided. Here are a small | |
example:: |