Skip to content

Instantly share code, notes, and snippets.

create table test_history
(
id int,
prop VARCHAR(16)
);
INSERT into test_history values ( 1,'a');
INSERT into test_history values ( 2,'b');
create TABLE updated_test ( id int ,prop VARCHAR(16));
@liprais
liprais / bias.rb
Last active July 23, 2018 14:38
gender_bias
#!/usr/bin/ruby
def birth
dice = rand(100)
return dice > 50 ? 1 : 0
end
### 生了男孩就不生了,生了女孩就一直生
@liprais
liprais / generate.py
Last active November 5, 2018 10:17
a pyspark script to take a parquet file path and generate external table ddl for splice machine
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
data_type_map = {'StringType':'varchar(32672)',
'LongType':'bigint',
'IntegerType':'int',
'BooleanType':'boolean',
'DateType':'date',
'DoubleType':'double',
'TimestampType':'timestamp'
}
@liprais
liprais / wtf.rb
Created August 29, 2019 13:10
58 my ass
require 'mysql2'
client = Mysql2::Client.new(:host => "localhost", :username => "root",:database => "test")
100.times do |i|
str = "insert into money_test ( money) values (#{rand(100)})"
p str
client.query(str)
end
1.
把已有的模型导出成pb格式
保存的时候的INFO:tensorflow:Unsupported signature for serialization貌似不用管
python code:
import os
os.environ['TF_KERAS'] = '1'
import numpy as np
from bert4keras.backend import K as K
from bert4keras.models import build_transformer_model
@liprais
liprais / use_tf_serving_with_bert4keras.txt
Last active November 27, 2022 16:10
让bert4keras使用Tensorflow serving调用模型
0.
基于tf2.0
1.
把已有的模型导出成pb格式
保存的时候的INFO:tensorflow:Unsupported signature for serialization貌似不用管
python code:
import os
os.environ['TF_KERAS'] = '1'
import numpy as np
select * from orders a join users b on a.p_user = b.PK;
select * from paymenttransactions a join orders b on a.p_order = b.pk;
select * from paymentmodes a join orders b on a.PK = b.p_paymentmode;
select * from orderentries a join orders b on a.p_order = b.pk;
select * from products a join orderentries b on a.PK = b.p_product;
select * from subentries a join guestinfos b on a.p_guestinfo = b.PK;
select * from subentries a join orderentries b on a.p_entry = b.PK;
select * from rules a join promotion p on a.p_code = p.p_code;