Skip to content

Instantly share code, notes, and snippets.

View francisluong's full-sized avatar

Francis Luong (Franco) francisluong

View GitHub Profile
@francisluong
francisluong / cfm_latency.junos.txt
Created April 9, 2014 18:18
JUNOS: How to Collect Latency from CFM
{master}
fluong@network-router-re0> show configuration protocols oam | display set | grep inter | trim 108
Apr 09 18:13:47
router2-0/0/0-router-0/1/2 mep 2 interface xe-0/1/2
fluong@network-router-re0> monitor ethernet delay-measurement two-way maintenance-association router2-0/0/0-router-0/1/2 maintenance-domain md-WWAN
Two-way ETH-DM request to 5c:5e:ab:da:07:cb, Interface xe-0/1/2.32767
DMR received from 5c:5e:ab:da:07:cb Delay: 3791 usec Delay variation: 0 usec
DMR received from 5c:5e:ab:da:07:cb Delay: 3797 usec Delay variation: 6 usec
DMR received from 5c:5e:ab:da:07:cb Delay: 3798 usec Delay variation: 1 usec
@francisluong
francisluong / compress.var.log.junos.txt
Last active August 29, 2015 13:59
JUNOS: compress /var/log/*
file archive compress source /var/log/* destination /var/tmp/re0-var-log.tgz
request routing-engine login other
file archive compress source /var/log/* destination re0:/var/tmp/re1-var-log.tgz
@francisluong
francisluong / csv_config_audit.vb
Last active August 29, 2015 14:00
Excel VBA to Format CSV into a Table with some conditional formats
Sub csv_config_audit_2()
'
' csv_config_audit_2 Macro
'
'
Range("A1").CurrentRegion.Select
ActiveSheet.ListObjects.Add(xlSrcRange, Range("A1").CurrentRegion, , xlYes).Name = _
"Table1"
Range("Table1[#All]").Select
@francisluong
francisluong / word_vba.vb
Created April 22, 2014 20:31
Word VBA - Franco's Macros
Sub AAA_underline_uber()
'
' underline_fluong Macro
' Find instances of text from searchTextArray which are not underlined and:
' - extend selection to end of line`
' - underline it
'
Sub ewan_description_3()
Columns("B:G").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A1").Select
ActiveCell.FormulaR1C1 = "mx"
Range("B1").Select
@francisluong
francisluong / netconf_show_config_proto_l2circuit_nei
Created June 19, 2014 12:06
Juniper Netconf: request to get a partial configuration
<rpc message-id="1002 Tue Jun 17 23:25:48 -0400 2014">
<get-config>
<source><candidate/></source>
<filter type="subtree">
<configuration>
<protocols>
<l2circuit>
<neighbor>
<name>1.2.3.4/name>
</neighbor>
@francisluong
francisluong / netconf_cfm_delay_measurement
Created June 19, 2014 12:08
Juniper Netconf: CFM monitor ethernet delay measurement
<rpc>
<request-monitor-ethernet-delay-measurement>
<two-way/>
<maintenance-domain>md-NAME</maintenance-domain>
<maintenance-association>ma-NAME</maintenance-association>
<mep>2</mep>
</request-monitor-ethernet-delay-measurement>
</rpc>
@francisluong
francisluong / excel_cfm_latency_table_format.vba
Last active August 29, 2015 14:02
Yet another Excel formatter
Sub cfm_latency_report()
'
' cfm_latency_report Macro
'
'
Range("A1").CurrentRegion.Select
ActiveSheet.ListObjects.Add(xlSrcRange, Range("A1").CurrentRegion, , xlYes).Name = _
"Table1"
Range("Table1[#All]").Select
@francisluong
francisluong / remove_namespace.xslt
Created June 29, 2014 19:16
XSLT to Remove Namespaces
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no"/>
<!-- stylesheet to remove all namespaces from a document -->
<!-- note: this will lead to attribute name clash if an element contains two attributes with same local name but different namespace prefix -->
<!-- template to copy elements -->
<xsl:template match="*">
<xsl:element name="{local-name()}">
@francisluong
francisluong / mac_bashrc
Last active August 29, 2015 14:04
MAC .bashrc
# Reset
Color_Off='\[\e[0m\]' # Text Reset
# Regular Colors
Black='\[\e[0;30m\]' # Black
Red='\[\e[0;31m\]' # Red
Green='\[\e[0;32m\]' # Green
Yellow='\[\e[0;33m\]' # Yellow
Blue='\[\e[0;34m\]' # Blue
Purple='\[\e[0;35m\]' # Purple