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
local function sample(it, count, random) | |
local answer = {} | |
do | |
-- first element | |
local element = it() | |
if element == nil then | |
return answer | |
end | |
answer[1] = element |
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
# agent type detection, based on idea from from http://notnotmobile.appspot.com/ | |
map $http_user_agent $agent_type_phase1 { | |
default 'mobile'; | |
'' 'unknown'; | |
~*iphone|ipod|blackberry|palm|windows\s+ce 'mobile'; | |
~*windows|linux|os\s+[x9]|solaris|bsd 'desktop'; | |
~*spider|crawl|slurp|bot|feedburner 'bot'; | |
} | |
map $http_x_skyfire_phone $agent_type_phase2 { | |
default 'mobile'; |
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 | |
# Destination must exist as empty repo on github | |
GIT_REPO="git@github.com:opencog/opencog.git" | |
TEMP_PATH=~/src/opencog_bzr_to_git | |
echo "Using $TEMP_PATH as working dir" | |
BRANCHES=(trunk UnityEmbodiment) | |
mkdir -p ${TEMP_PATH} | |
cd ${TEMP_PATH} |
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
/* Print chars' counts as C array of ints */ | |
#include <stdio.h> | |
// https://en.wikipedia.org/wiki/C_preprocessor#Token_stringification | |
#define xstr(s) str(s) | |
#define str(s) #s | |
#define NLETTERS 256 | |
#define BUFSIZE (1024 * 1024) |
NewerOlder