ntc – tempalates :cisco_ios_show_mac-address-table.template
#add this line in Type 3 – ^${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+${DESTINATION_PORT} -> Record Value DESTINATION_ADDRESS (\w+.\w+.\w+) Value TYPE (\w+) Value VLAN (\w+) Value DESTINATION_PORT (\S+) Start ^Destination\s+Address\s+Address\s+Type\s+VLAN\s+Destination\s+Port -> TYPE1 ^\s+vlan\s+mac address\s+type\s+learn\s+age\s+ports -> TYPE2 ^\s+vlan\s+mac address\s+type\s+protocols\s+port -> TYPE3 ^Vlan\s+Mac Address\s+Type\s+Ports -> TYPE4 TYPE1 ^${DESTINATION_ADDRESS}\s+${TYPE}\s+${VLAN}\s+${DESTINATION_PORT} -> Record TYPE2 ^[\*|\s]\s+${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+${DESTINATION_PORT} -> Record TYPE3 ^\s+${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+${DESTINATION_PORT} -> Record ^${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+${DESTINATION_PORT} -> Record TYPE4 ^\s+${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+${DESTINATION_PORT} -> Record Read More →
Perl: Diamon operator: <> , $_, the default variable
The Diamond operator is almost exclusively used in a while-loop. It allows us to iterate over the rows in all the files given on the command line. Diamond – using $_, the default variable We can make the above example even more compact by remembering that certain operation in Perl will use $_, the default variable of Perl, if no explicit variable is given. use strict; use warnings; while (<>) { print if /perl/; } Read More →
Route 53: Apex domain quick fix
apex, bare domain ( domain without www) and www.domain.com should point to the same IP. In amazon load balance or some of the cloud solution, they do not provide us a static IP, they provide us a name and asks us to point our domain to their domain. There is no problem with www.domain.com , but we can’t point apex domain (domain.com) to a cname record, it ‘s because the current DNS RFC does not allow this. There are many dns hosting providers customized their DNS to support this feature. If you are using Route53, you can use the script below to monitor the differenceRead More →
git: fatal: index-pack failed
I recently had to clone a very large repository through SSH, every time i did i got this error Cloning into ‘large-repository’… remote: Counting objects: 20248, done. remote: Compressing objects: 100% (10204/10204), done. error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed I could be the connection is bad , i finally fixed by using the commands below: $ git clone [email protected]:large-repository –depth 1 $ cd large-repository $ git fetch –unshallowRead More →
How to tell git which private key to use?
Environment variable GIT_SSH_COMMAND: From Git version 2.3.0, you can use the environment variable GIT_SSH_COMMAND like this: GIT_SSH_COMMAND=”ssh -i ~/.ssh/id_rsa_example” git clone example Note that -i can sometimes be overridden by your config file, in which case, you should give SSH an empty config file, like this: GIT_SSH_COMMAND=”ssh -i ~/.ssh/id_rsa_example -F /dev/null” git clone example Configuration core.sshCommand: From Git version 2.10.0, you can configure this per repo or globally, so you don’t have to set the environment variable any more! git config core.sshCommand “ssh -i ~/.ssh/id_rsa_example -F /dev/null” git pull git pushRead More →
Python: Realtime web print out
There are some situation when we run a time-consuming process, we need to see the output of that command to see its progress. Normally, we would have to wait until the process ends , then we can see the output. The reason for this is because web or standard output normally buffer some contents, it will wait for enough data to print out to the client. To fix this issue, we tell our server/script not buffering anything, print out immediately when it can. Here are some steps that i did in Python. Step1: Tell the server not buffering anything, don’t use gzip ( if weRead More →
PHP7: Parse error: syntax error, unexpected ‘new’ (T_NEW)
You might see that error when upgrading from PHP5 to PHP7 your code might look like this: $this->smilies =& new smilies_package($this->current_smilies); Solution: just remove & , it will fix.Read More →
How to check if your PHP support TLS V1.2?
Run this script to see your SSL Version <?php $ch = curl_init(‘https://www.howsmyssl.com/a/check’); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = curl_exec($ch); curl_close($ch); $json = json_decode($data); echo $json->tls_version; ?> If you want to check your open SSL version? <?php $curl_info = curl_version(); echo $curl_info[‘ssl_version’]; ?> OpenSSL 1.0.1 and later support TLS v1.1 and TLS v1.2 If you see your OpenSSL version from 1.0.1, then it will support TLS V1.1 and TLS V1.2Read More →