Skip to content

Instantly share code, notes, and snippets.

View robinvanemden's full-sized avatar
🌳
⏩ ⏩

Robin van Emden robinvanemden

🌳
⏩ ⏩
View GitHub Profile
/**
*
* Qualtrics_barebones_question_for_lif.js
* Javascript code to integrate Streamingbandit & Qualtrics.
* Sends an receives JSON to and from StreamingBandit server
*
**/
/* --- insert as <script> into look and feel ---*/
<strong>Eyewitness</strong>
Three suspects have been lined up by the police, and two witnesses are asked how certain they are of seeing each of the suspects at the crime-scene. Which subject would might have been at the crime scene, according to you?
<style type="text/css">
.table {
width: 100%;
border: 1px solid #C0C0C0;
border-collapse: collapse;
padding: 5px;
}
.table th {
@robinvanemden
robinvanemden / lif.py
Created January 2, 2016 13:47
Implementation of the Lock in Feedback algorithm in the Python Tornado based StreamingBandit web server
# Implementation of Lock in Feedback.
# -*- coding: utf-8 -*-
from libs.base import *
import numpy as np
import json
class Lif:
def __init__(self, theta, x0=1.0, A=1.4, T=100, gamma=.004, omega=0.8, lifversion=2):
self._set_parameters(x0, A, T, gamma, omega, lifversion)
# -*- coding: utf-8 -*-
import libs.lif as lf
key = "question"
value = self.context['question']
theta = self.get_theta(all_float=False, key=key, value=value)
Lif = lf.Lif(theta, x0=self.context['x0'], A=1.4 , T=100, gamma=.004, omega=.8, lifversion=2)
suggestion = Lif.suggest()
# -*- coding: utf-8 -*-
import libs.lif as lf
key = "question"
value = self.context['question']
theta = self.get_theta(all_float=False, key=key, value=value)
Lif = lf.Lif(theta, x0=self.context['x0'], A=1.4 , T=100, gamma=.004, omega=.8, lifversion=2)
Lif.update(self.action["t"],self.action["x"], self.reward)
self.set_theta(Lif, key=key, value=value)
import sys,random
import json
import asyncio,aiohttp,pymongo,time
import numpy as np
import matplotlib.pyplot as plt
MONGO_IP = "78.46.212.194"
MONGO_PORT = 27017
SB_BASE_URL = "https://strm.mnds.org:8080"
# -*- coding: utf-8 -*-
#==============================================================================
# Reset IPython - may delete the following when not making use of Spyder IDE
from IPython import get_ipython
get_ipython().magic('reset -sf')
# import libraries
# -*- coding: utf-8 -*-
#==============================================================================
# Reset IPython - may delete the following when not making use of Spyder IDE
from IPython import get_ipython
get_ipython().magic('reset -sf')
#==============================================================================
# -*- coding: utf-8 -*-
import libs.lif as lf
key = "question"
value = self.context['question']
theta = self.get_theta(all_float=False, key=key, value=value)
Lif = lf.Lif(theta, x0=self.context['x0'], A=self.context['A'], T=150, gamma=.06, omega=1.0, lifversion=1)
Lif.update(self.action["t"],self.action["x"], self.reward)
self.set_theta(Lif, key=key, value=value)
@robinvanemden
robinvanemden / ufw.sh
Last active July 22, 2016 10:41 — forked from kim3er/script
IP address limited UFW firewall config for Couchbase 4.5
#!/bin/sh
IP_ADDRESS="192.168.0.2"
ufw allow from $IP_ADDRESS to any port 4369
ufw allow from $IP_ADDRESS to any port 8091
ufw allow from $IP_ADDRESS to any port 8092
ufw allow from $IP_ADDRESS to any port 11214
ufw allow from $IP_ADDRESS to any port 11215
ufw allow from $IP_ADDRESS to any port 11209