This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class InsertTimeCommand(sublime_plugin.TextCommand): | |
| def run(self, edit): | |
| from time import asctime | |
| self.view.insert(edit, self.view.sel()[0].a, asctime()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| no hardware access-list update atomic ---> this brought TCAM util down | |
| re-apply access-group to vlan interface | |
| hardware access-list update atomic ---> this brought TCAM util back to where it was before |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ping -c1 ens-sj1 >/dev/null 2>&1 || echo 'fail' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # take a list of hosts by stdin and ping them | |
| while read line; do | |
| RESULT=`ping -c1 $line >/dev/null 2>&1 || echo 'fail'` | |
| if [ "$RESULT" = "" ]; then | |
| RESULT="pass" | |
| fi | |
| echo "$line -> $RESULT" | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dig unix.stackexchange.com | awk '/^;; ANSWER SECTION:$/ { getline ; print $5 }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_key(dic, val): | |
| """return the key of dictionary dic given the value""" | |
| return [k for k, v in symbol_dic.iteritems() if v == val][0] | |
| { | |
| 1: '128.0.0.0', 2: '192.0.0.0', | |
| 3: '224.0.0.0', 4: '240.0.0.0', | |
| 5: '248.0.0.0', 6: '252.0.0.0', | |
| 7: '254.0.0.0', 8: '255.0.0.0', | |
| 9: '255.128.0.0', 10: '255.192.0.0', | |
| 11: '255.224.0.0', 12: '255.240.0.0', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_key(dic, val): | |
| """return the key of dictionary dic given the value""" | |
| return [k for k, v in dic.iteritems() if v == val][0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| the_app=$( | |
| osascript 2>/dev/null <<EOF | |
| tell application "System Events" | |
| name of first item of (every process whose frontmost is true) | |
| end tell | |
| EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import multiprocessing | |
| import os | |
| import requests | |
| ######################################################################## | |
| class MultiProcDownloader(object): | |
| """ | |
| Downloads urls with Python's multiprocessing module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Auto-filled variables | |
| USER_NAME=$(/usr/bin/who am i | /usr/bin/awk '{print $1}') | |
| SELF=$(/usr/bin/basename $0) | |
| USER_ID=$(id | sed 's/uid=\([0-9]*\).*/\1/') | |
| OUR_PID=$(ps -ef | grep ${SELF} | grep -v 'grep' | awk -v uid="$USER_ID" '$1==uid {print $2; exit;}') # Only first occurence from the current user. | |
| # Constants |
OlderNewer