Skip to content

Instantly share code, notes, and snippets.

View greenlion's full-sized avatar

Justin Swanhart greenlion

View GitHub Profile
MariaDB [bcnum]> select * from t1;
+-----------------------+
| c1 |
+-----------------------+
| 1.8446744073709552e19 |
| 9.223372036854776e18 |
| 9.223372036854776e18 |
+-----------------------+
3 rows in set (0.000 sec)
package main
import (
"database/sql"
"fmt"
"github.com/greenlion/go-myquery/myquery"
"github.com/pborman/getopt/v2"
"time"
)
#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.
*/
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 "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;
}
@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++) {
@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 / 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.*;
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
Nearly everybody is familiar with the story about how Isaac Newton discovered gravity when an apple fell on his head. He hypothesized that the apple was pulled to the Earth by Earth’s gravity, when it fell from the tree, which is a reasonable hypothesis. Literally every educated person born after Newton’s work was published (Whitman, 1999) everyone has agreed with this hypothesis, including Einstein. In Newton’s view, the Earth has a very strong pull on objects, and that pulling force is reduced greatly by the “opposite” pull on Earth by all other objects. This this the very small constant G which pulls almost all the force out of the relationship between two masses in Newton’s equation: F=(Gm_1 m_2)/r^2 .
Unfortunately, Newton got that wrong. The Earth exerts an incredible outward force which affects the topology of space which I call displacement deformation of space (or just displacement). The displacement of the mass of the Earth would throw everything off the surface but for the opposite displace