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
<?php | |
//This is a port of Ken Perlin's "Improved Noise" | |
// http://mrl.nyu.edu/~perlin/noise/ | |
// Originally from http://therandomuniverse.blogspot.com/2007/01/perlin-noise-your-new-best-friend.html | |
// but the site appears to be down, so here is a mirror of it | |
class Perlin { | |
var $p, $permutation, $seed; |
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
// Generated by CoffeeScript 1.6.3 | |
(function() { | |
var avatar, blockPosErase, blockPosPlace, container, createGame, createPlayer, currentMaterial, defaults, extend, fly, game, generate, highlight, hl, makeFly, player, texturePath, voxel; | |
generate = function(x, y, z) { | |
if (x % 32 === 0 && z % 32 === 0) { | |
return 3; | |
} | |
if (x % 32 === 0 && y % 32 === 0) { | |
return 5; |
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
select count(*) | |
from ontime_fact | |
join dim_date on ontime_fact.date_id = dim_date.date_id | |
where `Year` between 1990 and 1994 and `Quarter` = 1; | |
select FlightDate, count(*) | |
from ontime_fact | |
join dim_date on ontime_fact.date_id = dim_date.date_id | |
join dim_flight on ontime_fact.flight_id = dim_flight.flight_id | |
where `Year` = 1998 and `Quarter` = 1 |
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
<?php | |
/* a sample of traffic data from the real website, deduplicated and REST URLs digested */ | |
$traffic = unserialize(file_get_contents('seed.dat')) or die('Could not unserialize seed.dat'); | |
/* 20% chance by default */ | |
function chance($greater_than=20, $bottom=1, $top = 100) { | |
$toss = mt_rand($bottom, $top); | |
if($greater_than >= $toss) return true; else return false; | |
} |
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
/* | |
FastBit UDF for MySQL (c) 2015 Justin Swanhart | |
Specification 1.0-DRAFT | |
*/ | |
/* | |
fb_create(table_dir=>'/path/to/fastbit/data',colspec=>'c1:int,c2:int'); | |
fb_load(table_dir=>'/path/to/fastbit/data', datafile=>'/path/to/file/to/load.txt'); | |
fb_query(table_dir=>'/path/to/fastbit/data',query_string=>'select count(*) where c1 between 1 and 10', temp_dest=>'temporary_table_name'); | |
fb_hits(table_dir=>'/path/to/fastbit/data',query_string=>'select count(*) where c1 between 1 and 10', temp_dest=>'temporary_table_name'); |
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
delimiter ;; | |
create database if not exists shard_query;; | |
use shard_query;; | |
drop procedure if exists sq_helper;; | |
drop procedure if exists sq_throw;; | |
create procedure sq_throw(v_err text) | |
begin | |
signal sqlstate '45000' set | |
class_origin = 'Fastbit_UDF', | |
subclass_origin = 'Fastbit_UDF', |
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 "presto.h" | |
#include "myphp.h" | |
#include <iostream> | |
#include <string> | |
/* This function hooks PHP output to the error log*/ | |
void php_log_output(const char *str){ | |
std::cerr << str; | |
} |
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
/* | |
* Compile with: | |
* g++ -std=c++11 -shared -I `mysql_config --include` `mysql_config --cxxflags` flatten_udf.cpp -o flatten_udf.so | |
*/ | |
#pragma GCC diagnostic ignored "-Wwrite-strings" | |
#include "presto.h" | |
#include <iostream> | |
#include <string> | |
#include "rapidjson/reader.h" |
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
mysql> select doc from json2 where match(flat) against ('last_name=Vembu')\G | |
*************************** 1. row *************************** | |
doc: { "_id" : { "$oid" : "52cdef7c4bab8bd675297d8b" }, "name" : "AdventNet", "permalink" : "abc3", "crunchbase_url" : "http://www.crunchbase.com/company/adventnet", "homepage_url" : "http://adventnet.com", "blog_url" : "", "blog_feed_url" : "", "twitter_username" : "manageengine", "category_code" : "enterprise", "number_of_employees" : 600, "founded_year" : 1996, "deadpooled_year" : 2, "tag_list" : "", "alias_list" : "Zoho ManageEngine ", "email_address" : "pr@adventnet.com", "phone_number" : "925-924-9500", "description" : "Server Management Software", "created_at" : { "$date" : 1180121062000 }, "updated_at" : "Wed Oct 31 18:26:09 UTC 2012", "overview" : "<p>AdventNet is now <a href=\"/company/zoho-manageengine\" title=\"Zoho ManageEngine\" rel=\"nofollow\">Zoho ManageEngine</a>.</p>\n\n<p>Founded in 1996, AdventNet has served a diverse range of enterprise IT, networkin |
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
template<typename K, class D> | |
class PageManager { | |
private: | |
Node* first; | |
Node* last; | |
K nodecount = 0; | |
K max_nodes = 0; | |
std::hash_set<K, Node*> page_table; | |
void* flusher = NULL; // The flusher is a callback function which is called when pages | |
// fall off the tail of the LRU maintained by the PageManager. |
OlderNewer