Skip to content

Instantly share code, notes, and snippets.

View iamdanielyin's full-sized avatar
🎯
Focusing

Daniel Yin iamdanielyin

🎯
Focusing
View GitHub Profile
@iamdanielyin
iamdanielyin / difference.js
Created February 1, 2019 06:54 — forked from Yimiprod/difference.js
Deep diff between two object, using lodash
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
FROM theiaide/theia
USER root
RUN echo "http://mirrors.aliyun.com/alpine/v3.8/main/" > /etc/apk/repositories
RUN apk update && apk add python make tzdata vim \
&& rm -f /etc/localtime \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
@iamdanielyin
iamdanielyin / gist:f8506e3fb088a897f3efd3013c1982ea
Last active March 15, 2018 08:48
Kubernetes阿里云镜像
cat <<EOF> /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
EOF
@iamdanielyin
iamdanielyin / clear_docker.sh
Last active March 15, 2018 03:43
Docker空间清理脚本
#!/bin/bash
# Docker空间清理脚本
# Author: Daniel
# Date: 2017/12/11
# Version: 1.0
none_image=`docker images -f 'dangling=true' -q`
if [ "_$none_image" != "_" ]; then
docker rmi -f $none_image
echo "删除none的镜像 --> ok!"
#!/bin/bash
# 1.创建nginx目录
mkdir /opt/nginx && cd /opt/nginx
# 1.1注册nginx启动脚本
tee /opt/nginx/up.sh <<-'EOF'
#/bin/bash
if [ ! -d $PWD/certs ]; then
mkdir $PWD/certs
@iamdanielyin
iamdanielyin / gist:ab065aa800bf67950d9f91679dd899ec
Created August 26, 2017 09:48
node微信签名算法(sha1)
const crypto = require('crypto');
/**
* 根据传入对象生成签名并返回
* @param object 原始对象
* @returns {*} 签名值
*/
app.sign = (object) => {
console.log('生成签名前的对象:' + JSON.stringify(object, null, 0));
if (!object || Object.keys(object).length == 0) return null;