Skip to content

Instantly share code, notes, and snippets.

View danieldai's full-sized avatar
🎯
Focusing

Daniel Dai danieldai

🎯
Focusing
View GitHub Profile
@danieldai
danieldai / gist:f29007f62d31fecdf63d28a963879684
Created January 23, 2025 12:52
opensearch example docker-compose.yml
services:
opensearch:
image: opensearchproject/opensearch:latest
container_name: opensearch
environment:
- discovery.type=single-node
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=1ASDF123Aa!#
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # Adjust heap size as needed
ulimits:
@danieldai
danieldai / get_next_property.js
Last active November 26, 2021 08:15
get_next_property.js
function getNestedProperty(obj, path) {
let myObj = obj;
for (let name of path.split('.')) {
if (myObj) {
myObj = myObj[name];
} else {
break;
}
}
return myObj;
@danieldai
danieldai / gome.py
Last active September 13, 2021 06:15
A script to scrape gome shop list
import requests
import json
# 用来爬取国美在线店铺列表的python脚本
provices = {
'11000000': '北京',
'12000000': '天津',
'13000000': '河北省',
'14000000': '山西省',
'15000000': '内蒙古',
@danieldai
danieldai / t.js
Created February 1, 2021 09:03
Get nested property of a JavaScript object
function getNestedProperty(obj, path) {
let myObj = obj;
for (let name of path.split('.')) {
if(myObj) {
myObj = myObj[name];
} else {
break;
}
}
return myObj;
@danieldai
danieldai / gist:42c758f639155f7281821b66839bd1c0
Created October 19, 2018 08:14
The single command to import cert into java system truststore for all linux like systems
sudo keytool -import -alias cacerts -keystore $(readlink -f /usr/bin/java | sed "s:bin/java::")lib/security/cacerts -file ca.crt