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
| <?php | |
| function get_mac_maps($switch_name, $switch_ip, $snmpcommunity, $baseoid, &$map) { | |
| exec('snmpwalk -v1 -On -Cc -c ' . $snmpcommunity . ' ' . $switch_ip . ' ' . $baseoid, $ret); | |
| $data = array(); | |
| foreach ($ret as $line) { |
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 | |
| CURR_WIN_ID=$(xprop -root _NET_ACTIVE_WINDOW | sed -e 's/.*# //') | |
| XPID="" | |
| XSUBPID="" | |
| XCWD="" | |
| test -n "${CURR_WIN_ID}" && XPID=$(xprop -notype -id "$CURR_WIN_ID" _NET_WM_PID | sed -e 's/^.* = //') |
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 | |
| if [ -z "$SSH_AGENT_PID" ]; then | |
| echo "no ssh agent" | |
| ssh-agent "$0" "$@" | |
| exit $? | |
| fi | |
| set -e -x |
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
| from flask import Flask, request | |
| from flask import request | |
| import logging | |
| import tempfile, os, md5, sys | |
| app = Flask(__name__) | |
| app.logger.addHandler(logging.StreamHandler(stream=sys.stderr)) | |
| @app.route("/") | |
| def hello(): |
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
| # source http://unix.stackexchange.com/questions/148/colorizing-your-terminal-and-shell-environment | |
| export COLOR_NC='\e[0m' # No Color | |
| export COLOR_WHITE='\e[1;37m' | |
| export COLOR_BLACK='\e[0;30m' | |
| export COLOR_BLUE='\e[0;34m' | |
| export COLOR_LIGHT_BLUE='\e[1;34m' | |
| export COLOR_GREEN='\e[0;32m' | |
| export COLOR_LIGHT_GREEN='\e[1;32m' | |
| export COLOR_CYAN='\e[0;36m' |
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
| # /etc/ssh/sshd_config | |
| # ..... | |
| Match User zsteva | |
| PermitTunnel yes |
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
| # local | |
| local> cat ISO.ISO | split -b 1M --filter="md5sum -" | tee _local | |
| # ok file | |
| remote> cat ISO.ISO | split -b 1M --filter="md5sum -" | tee _remote | |
| remote> diff -u _local _remote | |
| --- _local 2016-11-13 19:10:05.703613885 +0100 | |
| +++ _remote 2016-11-13 19:09:28.440378205 +0100 | |
| @@ -1214,7 +1214,7 @@ |
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
| <?php | |
| function excell_arr2csv($header, $data) { | |
| $line = ''; | |
| foreach ($header as $field) { | |
| $d = isset($data[$field]) ? $data[$field] : ''; | |
| $d = str_replace("\n", " ", $d); | |
| $d = str_replace('"', '""', $d); |
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 | |
| # src http://fnxweb.com/blog/2012/08/02/read-the-current-terminal-size-from-within-bash/ | |
| # Request size | |
| stty -echo | |
| echo -ne '\e[18t' | |
| # Read size char. by char. (CSI 8 ; height ; width t) | |
| width= |
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 | |
| stat() { | |
| echo "BAT0" | |
| # echo -n " startThreshold: "; tpacpi-bat -g ST 1 | |
| # echo -n " stopThreshold: "; tpacpi-bat -g SP 1 | |
| echo -n " startThreshold: "; cat /sys/class/power_supply/BAT0/charge_start_threshold | |
| echo -n " stopThreshold: "; cat /sys/class/power_supply/BAT0/charge_stop_threshold | |
| echo |
OlderNewer