Skip to content

Instantly share code, notes, and snippets.

View asd1245dss's full-sized avatar

Summer asd1245dss

View GitHub Profile
@asd1245dss
asd1245dss / install-result-schema.txt
Created March 1, 2021 06:56
初始化atlas的result配置信息
CREATE TABLE IF NOT EXISTS results.cohort
(COHORT_DEFINITION_ID int NOT NULL,
SUBJECT_ID bigint NOT NULL,
cohort_start_date date NOT NULL,
cohort_end_date date NOT NULL
);
CREATE TABLE IF NOT EXISTS results.cohort_censor_stats (cohort_definition_id int NOT NULL,
lost_count BIGINT NOT NULL
@asd1245dss
asd1245dss / config-gis.js
Created February 22, 2021 00:59
Atlas external js config
define([
'./config/app',
'./config/terms-and-conditions',
'lodash',
], function (app, termsAndConditions, localConfig, gisConfig, lodash) {
if (JSON.stringify(localConfig) == JSON.stringify({})) {
console.warn('Local configuration not found. Using default values. To use a local configuration and suppress 404 errors, create a file called config-local.js under the /js directory');
}
Jedis jedis = new Jedis();
long result = jedis.setnx("namespace + orderId", "当前时间戳 + 过期时间");
// key不存在,获取锁成功
if (result == 1) {
System.out.println("key不存在,获取锁成功");
}
// key存在判断时间戳是否过期
if (result == 0) {
@asd1245dss
asd1245dss / SkipList.java
Created October 10, 2019 06:04
跳表数据结构
package com.taimeitech.pv.alg;
import lombok.Data;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Random;
/**
* <p>
public static int romanToInt(String s) {
int[] numArray = new int[26];
numArray['I' - 'A'] = 1;
numArray['V' - 'A'] = 5;
numArray['X' - 'A'] = 10;
numArray['L' - 'A'] = 50;
numArray['C' - 'A'] = 100;
numArray['D' - 'A'] = 500;
numArray['M' - 'A'] = 1000;
private static boolean isPalindrome(int x) {
if (x < 0) {
return false;
}
long originalNum = x;
long reverseNum = 0;
while (x != 0) {
/**
* 整数反转
* @param x 32位的整数
* @return 如果超过最大最小限制,则返回0,否则返回反转之后的数字,符号位不变
*/
private static int reverse(int x) {
boolean negative = false;
final int decimal = 10;
final StringBuilder stringBuilder = new StringBuilder();
@asd1245dss
asd1245dss / 删除Maven目录下的*.lastUpdated文件
Last active February 13, 2019 01:26
for /r %i in (*.lastUpdated) do del %i
package com.extracme.evcard.eye.common;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
@asd1245dss
asd1245dss / CardValidation.java
Created January 22, 2019 06:55
基于luhn算法实现的银行卡号校验
package com.extracme.evcard.eye.common;
/**
* @version 2019-01-22 09:31
*/
public class CardValidation {
private static boolean checkBankCardNo(String cardNo) {
char[] cartNoArray = cardNo.toCharArray();
int cardNoLength = cartNoArray.length;
@asd1245dss
asd1245dss / ElasticQueryBuilder.java
Created April 27, 2018 02:10
全清键(AC)按下该键表示清除所有寄存器中的数值。 清除输入键(CE)在数字输入期间按下此键将清除输入寄存器中的值并显示"0"。 AC = All Clear CE = Clear Entr
package com.evcard.demo.test.elastic.search;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpHost;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;