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
#include <stdlib.h> | |
/* | |
Returns a pointer to the first occurrence of character in the C string str. | |
The terminating null-character is considered part of the C string. Therefore, | |
it can also be located to retrieve a pointer to the end of a string. | |
@param str the string to be searched | |
@param len the number of characters to search | |
@param character the character to search for |
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
#include <string.h> | |
#include <uthash.h> | |
// this is an example of how to do a LRU cache in C using uthash | |
// http://uthash.sourceforge.net/ | |
// by Jehiah Czebotar 2011 - jehiah@gmail.com | |
// this code is in the public domain http://unlicense.org/ | |
#define MAX_CACHE_SIZE 100000 |
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
# This is a simple way to run multiple things in parallel in a bash | |
# script without making things too complicated | |
# it's modeled after (and uses) the bash `wait` command | |
# TIP: to do more complicated steps in parallel put them in a function | |
function wait_run_in_parallel() | |
{ | |
local number_to_run_concurrently=$1 | |
if [ `jobs -np | wc -l` -gt $number_to_run_concurrently ]; then | |
wait `jobs -np | head -1` # wait for the oldest one to finish |
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
#!/bin/sh | |
# this loop uses "read" to parse stdin into variables | |
# stdin is specified at the ending "done" with < input_file, or | |
# in this case, an inline block of text. | |
while read host port; do | |
echo "host $host port $port"; | |
done << EOF | |
google.com 80 |
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
#!/bin/env python | |
""" | |
This is a test script to simulate a memcached instance on a server | |
that has gone south and is accepting connections, but generally not | |
responding. | |
The goal of this script is to help test/develop correct client | |
side settings for timeouts/failure scenarios |
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
moved to github --> https://github.com/bill-auger/git-branch-status/ |
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
#import <Cocoa/Cocoa.h> | |
#import <UIKit/UIKit.h> | |
@class ChameleonAppDelegate; | |
@interface AppDelegate : NSObject <NSApplicationDelegate> { | |
@private | |
NSWindow *window; | |
IBOutlet UIKitView *chameleonNSView; | |
ChameleonAppDelegate *chameleonApp; | |
} |
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
TARGET="$PROJECT_DIR/project/Info.plist" | |
echo $TARGET | |
if [ ! -f "$TARGET" ]; then | |
echo "missing file $TARGET" | |
exit 1; | |
fi | |
# the perl regex splits out the last part of a build number (ie: 1.1.1) and increments it by one | |
# if you have a build number that is more than 3 components, add a '\.\d+' into the first part of the regex. |
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
#!/bin/bash | |
COUNT=1 | |
FILE=$0 | |
# run this script with bash | |
# i bet you can't predict the outcome | |
function printsleep { | |
echo COUNT=$(( COUNT++ )) | |
echo printsleep >> $FILE |
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
#!/bin/sh | |
# | |
# This is a script to run syntax check (via `sh -n $filename`) but it | |
# supports recursive checking and --quiet | |
QUIET=0 | |
while [ "$1" != "" ]; do | |
PARAM=`echo $1 | awk -F= '{print $1}'` | |
VALUE=`echo $1 | awk -F= '{print $2}'` | |
case $PARAM in |