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 <stdio.h> | |
#include <switch.hpp> | |
// Default option shall be one higher than the last | |
enum { ADD = 0, SUB = 1, MUL = 2, DIV = 3, MOD = 4, DEFAULT = 5 }; | |
template <int Operation> | |
struct interpreter { | |
static inline int run(const int x, const int y); | |
}; |
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
let $content := file:read-text-lines("webapp/examples.utf") | |
let $n := count($content) | |
return | |
<sentences>{ | |
for $i in (1 to $n) | |
where $i mod 2 = 1 | |
let $tokens := fn:tokenize(substring($content[$i],4),"#|\t") | |
return | |
<record> | |
<jpn>{$tokens[1]}</jpn> |
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
file:write( | |
"data.xml", | |
csv:parse(fetch:text("data.csv"), | |
map{"separator":"tab"})) |
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
let $content := file:read-text-lines("webapp/examples.utf") | |
let $n := count($content) | |
for $i in (1 to $n) | |
where $i mod 2 = 1 | |
return <record><jpn>{substring(substring-before($content[$i]," "),4)}</jpn><eng>{substring-before(substring-after($content[$i]," "),"#")}</eng></record> |
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
let $db := db:open("sentences")//sentences/record | |
let $n := random:integer(count($db))+1 | |
return $db[$n] |
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
def calculate_distance(pt1, pt2): | |
lat1, lon1 = pt1 | |
lat2, lon2 = pt2 | |
r = 6371000.0 | |
dlat = math.radians(lat2 - lat1) | |
dlon = math.radians(lon2 - lon1) | |
a = math.sin(dlat/2)**2 | |
a +=math.cos(math.radians(lat1))*math.cos(math.radians(lat2))*math.sin(dlon/2)**2 | |
c = 2*math.atan2(math.sqrt(a), math.sqrt(1-a)) |
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
def calculate_heading(pt1, pt2): | |
lat1, lon1 = pt1 | |
lat2, lon2 = pt2 | |
y = math.sin(math.radians(lon2-lon1)) * math.cos(math.radians(lat2)) | |
x = math.cos(math.radians(lat1))*math.sin(math.radians(lat2)) | |
x-= math.sin(math.radians(lat1))*math.cos(math.radians(lat2))*math.cos(math.radians(lon2-lon1)) | |
return math.degrees(math.atan2(y, x)) |
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
def distance_in_direction(origin, distance, direction): | |
lat1, lon1 = origin | |
lat1 = math.radians(lat1) | |
lon1 = math.radians(lon1) | |
r = 6371000.0 | |
lat2 = math.asin(math.sin(lat1)*math.cos(distance/r)+math.cos(lat1)*math.sin(distance/r)*math.cos(math.radians(direction))) | |
lon2 = lon1 + math.atan2(math.sin(direction)*math.sin(distance/r)*math.cos(lat1), math.cos(distance/r)-math.sin(lat1)*math.sin(lat2)) | |
return math.degrees(lat2), math.degrees(lon2) |
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
r''' | |
================================== | |
Kalman Filter tracking a sine wave | |
================================== | |
This example shows how to use the Kalman Filter for state estimation. | |
In this example, we generate a fake target trajectory using a sine wave. | |
Instead of observing those positions exactly, we observe the position plus some | |
random noise. We then use a Kalman Filter to estimate the velocity of the |
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
libqt4: | |
debian: [libqtcore4] | |
python-neo4j: | |
debian: | |
pip: | |
packages: [neo4j] | |
ubuntu: | |
pip: | |
packages: [neo4j] |
OlderNewer