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 / 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