Skip to content

Instantly share code, notes, and snippets.

View misgeatgit's full-sized avatar
🎯

Misgana Bayetta misgeatgit

🎯
  • opencog
  • HongKong
View GitHub Profile
function getAllConnected(atom, rawResult, visited /* pass me empty list */) {
var all = [];
var findMeById = function (id, list) {
for(i in list){
if(list[i].handle == id)
return list[i];
}
return null;
};
/*
* A DFS based subhypergraph finder.
*
* Recursively find all connections and subconnections of an atom
* From an array of atoms(responded from the RESTful response.)
*
* @param atom - A single atom from the rest response
* @param rawResult - A collection of atoms from the REST response.
*
* @return - All connection and subconnections of @param atom.
@misgeatgit
misgeatgit / DeadlockTestModule.cc
Last active July 19, 2016 06:34
Bug reproduction code:
/*
STEPS TO BUILD and observe the error
-------------------------------------
1. create a dir (eg. deadlocker) inside opencog/opencog
2. create a CMakeLists.txt file with the following content
ADD_LIBRARY(deadlocktest SHARED DeadlockTestModule)
TARGET_LINK_LIBRARIES(deadlocktest server ${ATOMSPACE_LIBRARIES})
3. Add the following to opencog/CMakeLists.txt
ADD_SUBDIRECTORY(deadlocker)
4. build as usual
import web.api.restapi
web.api.restapi.Start().run(None, ATOMSPACE)
'''
export OC_HOME_DIR="/home/opencog/Desktop/OPENCOG/opencog"
export PYTHONPATH="${PYTHONPATH}:/usr/local/share/opencog/python"
export PYTHONPATH="${PYTHONPATH}:$OC_HOME_DIR/opencog/python/"
export PYTHONPATH="${PYTHONPATH}:$OC_HOME_DIR/build/opencog/cython"
'''
# The executable has output sth like:
# cnode-8
# cnode-77
# cnode-7
# .
# .
# Which are randomly selcted outpus from cnode-i set where i is a natural number bn 0 and 2000.
# and the selection is done 10,000 times.
# Objective:
# count how many times each cnode-i has been choosen out of 10,000 draws.
# Artanis is a guile web framework. Below are some code snippets demonestrating how to use it.
#------------------------------------------------------------------------------------------------
# A simple demo of parsing get parameters. eg. http://127.0.0.1:8080/hello?first=Foo&last=Bar
guile -c '(use-modules (artanis artanis))(get "/hello" (lambda (rc)(format #f "<h1 s style=\"color:YellowGreen\">Hola ~a ~a!</h1> " (params rc "first") (params rc "last")))) (run #:port 8080)'
@misgeatgit
misgeatgit / print_time.cc
Created May 11, 2017 05:10
print time_point
#include <iostream>
#include <chrono>
#include <ctime>
#include <iomanip>
#include <sstream>
#include <string>
using namespace std::chrono;
int main(){

ECAN latest updates

Features added

  • Multithreaded mode
  • Runtime parameter loading and updating
  • Agents divided further more in to AF(AFImportanceUpdatingAgent and AFRentCollectionAgent) agents and WA agents (WAImportanceUpdatingAgent, WARentCollectionAgent)
  • Fine grained control of agent's runing time is possible. i.e via sleep sys call
  • Floating point importance values
/*
* Given a binary matrix, find the largest subsquare matrix.
*
*
*/
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
typedef unsigned int uint;
diff --git a/opencog/attention/ImportanceDiffusionBase.cc b/opencog/attention/ImportanceDiffusionBase.cc
index 850818f..23f6244 100644
--- a/opencog/attention/ImportanceDiffusionBase.cc
+++ b/opencog/attention/ImportanceDiffusionBase.cc
@@ -131,35 +131,6 @@ void ImportanceDiffusionBase::diffuseAtom(Handle source)
AttentionValue::sti_t totalDiffusionAmount =
calculateDiffusionAmount(source);
-#ifdef LOG_AV_STAT
- // Log sti gain from spreading via non-hebbian links