DALLASCAO.COM

Site of Cao Shouguang, English to Chinese translator

Using .p12 to connect to a VPN using Cisco Anyconnect client on Linux

Using .p12 to connect to a VPN using Cisco Anyconnect client on Linux
.p12 is a cert package file that contains both the certificate and the private key. You need both to connect to VPN usng Cisco Anyconnect client. 1. Extract the public certificate and the private key from your .p12 file. Suppose the .p12 file is “guest.p12”. Open Terminal and run: openssl pkcs12 -in guest.p12 -out guest.crt […]Read More

chain game code [rock, scissor, paper]

chain game code [rock, scissor, paper]
class chainGame {     /**      *      * @param {Array} hands two players hands. e.g. [1,2]      * @param {Array} symbols  symbols of the game      */     constructor(hands, symbols) {         this.hands = hands         this.symbols = symbols     } […]Read More

Javascript: Always define var outside if

Javascript: Always define var outside if
if (true) {     const a="yes" } else {     const a="no" } console.log(a); //throw an error that a is not definedRead More

this in object method functions

this in object method functions
//three ways of writing a method function for an object const temp = {     name:"dallas",     method1:function(){         console.log(this.name); //dallas     },     method2() {         console.log(this.name); //dallas     },     method3:()=>{         console.log(this.name); //undefined     }   […]Read More

ES6: Let async functions return promise object

ES6: Let async functions return promise object
function myWait (){         return (() => {             return new Promise(function (resolve) {                 function Callback() {                     resolve("All right sparkly");                 }; […]Read More