Snippets Collections
function deepCopy(obj){
    let toString = Object.prototype.toString;
    if(typeof obj !== 'object') return obj;
    if(obj === null) return null;
    if(Array.isArray(obj)) return obj.map(deepCopy);
    let newObj = {};
    for(let key in obj){
        if(toString.call(obj[key])==='[object Date]'){
            newObj[key] = new Date(obj[key])
        } else if(toString.call(obj[key])==='[object RegExp]'){
            newObj[key] = new RegExp(obj[key])
        }else{
            newObj[key] = deepCopy(obj[key]);
        }
    }
    return newObj;
}
#To Download File From Remote Server To Local Machine Using SCP.using Powershell or gitbash 
scp -i .\keys.pem ubuntu@XX.XX.XX.XX:/home/ubuntu/Dir/fileName  C:\Users\USER\Downloads\
# Do not forget the trailing dash in the source and target destinaton paths!

# Synchronize current directory to server
rsync -avPh --stats --delete ./ HOST:REMOTE_PATH/
  
# Synchronize a local directory to server
rsync -avPh --stats --delete LOCAL_PATH/ HOST:REMOTE_PATH/
  
# Sync remote server with local path
rsync -avPh --stats --delete HOST:REMOTE_PATH LOCAL_PATH
star

Sun Jun 19 2022 04:40:24 GMT+0000 (Coordinated Universal Time)

#javascript #object #deep #copy #clone #recursion
star

Wed Feb 09 2022 12:16:12 GMT+0000 (Coordinated Universal Time) own

#linux #shellscript #scp #copy
star

Wed Aug 04 2021 16:56:10 GMT+0000 (Coordinated Universal Time)

#server #sync #copy

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension