Skip to content

Instantly share code, notes, and snippets.

View greenlion's full-sized avatar

Justin Swanhart greenlion

View GitHub Profile
<?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;
@greenlion
greenlion / index.js
Created January 4, 2014 11:28
requirebin sketch
// 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;
select d_year, s_nation, p_category,
sum(lo_revenue - lo_supplycost) as profit
from lineorder
join dim_date
on lo_orderdatekey = d_datekey
join customer
on lo_custkey = c_customerkey
join supplier
on lo_suppkey = s_suppkey
join part
@greenlion
greenlion / physics.pde
Created June 5, 2016 15:15
start of the physic library for a universal simulator based on 'different physics'
import javax.measure.*;
import javax.measure.converter.*;
import javax.measure.quantity.*;
import javax.measure.unit.*;
import javax.realtime.*;
import javolution.*;
import javolution.context.*;
import javolution.io.*;
import javolution.lang.*;
import javolution.testing.*;
@greenlion
greenlion / sqlite_CS_schema
Created June 26, 2016 23:14
A schema for holding extents for a column in a column store
-- in dict.db
-- columns are created in partitions of file_max_hwm size
create table columns (
column_id integer primary key,
rowcount, -- count of
extent_size integer,
name blob,
data_type integer, 0 = int, 1=unsigned int, 2=float, 3=double, 4=string
data_extra1,
data_extra2,
@greenlion
greenlion / remote_exec.cpp
Last active September 5, 2016 15:46
embedded PHP UDF example (get remote SQL result as JSON)
#include "util.h"
extern "C" {
my_bool remote_exec_init(UDF_INIT *initid, UDF_ARGS *args, char* message) {
if(args->arg_count != 6) {
strcpy(message,"usage: remote_exec(host,port,user,pass,db,query)");
return 1;
}
for(unsigned int i=0;i<args->arg_count;i++) {
#include "mysql/service_my_plugin_user_var.h"
SERVICE_VERSION *user_var_service= (void*)VERSION_user_var;;
bool get_var(THD* thd, const String name, String* value) {
return false;
}
bool set_var(THD* thd, const String name, const String value) my_plugin_user_var_service->set_var(thd, name, value) {
return false;
}
root@debian-c-32-64gib-nyc1-01:~/warpsql-server/build# make
[ 0%] Built target INFO_SRC
[ 0%] Built target INFO_BIN
[ 0%] Built target abi_check
[ 0%] Built target zlib
[ 1%] Built target edit
[ 2%] Built target event_extra
[ 3%] Built target event
[ 4%] Built target event_core
[ 10%] Built target icuuc
#include "../../components/mysql_server/my_plugin_shim.h"
PSI_memory_key key_memory_shim_iterator;
/**
Its a dummy initialization function. And it will be called from
mysql_component_infrastructure_init(). Else linker, is cutting out (as
library optimization) the string service code because libsql code is not
calling any functions of it.
*/
package main
import (
"database/sql"
"fmt"
"github.com/greenlion/go-myquery/myquery"
"github.com/pborman/getopt/v2"
"time"
)