This file contains 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
A bash "one-liner" that requires serious explaining: | |
A Polycom phone will automatically reboot if you change anything in its webui (but you have to change something). This bash/awk/curl loop changes the length of time between sntp resyncs (basically a super-trivial setting) from 86400 seconds (1 day) to 86401. If you run this twice, you would need to change 86401 back to 86400. This is a super-dirty hack. Also note that this sets the sntp server to pool.ntp.org, and the time zone to Pacific (-28800). Although those settings will get overridden if you're setting those in your DHCP scope (which you should), please adjust as necessary. To clarify, $i is an IP address. In this example, I get a list of phone IPs from asterisk and grep the ones I need to reboot, but you can iterate over any list of IPs. | |
---------- | |
for i in $(asterisk -rx 'sip show peers' | grep 192.168.10 | awk '{print $2}'); do curl -s --user Polycom:456 -H application/x-www-form-urlencoded --referer http://$i/timeConf.htm -d "tcpIpApp.sntp.ad |
This file contains 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
# this assumes you have a default directory defined | |
find /tftpboot/logs/ | ack 'logs/([^-]+)' --output '$1' | sed '/^$/d' | while read mac | |
do | |
cp -f "000000000000-directory.xml" "$mac-directory.xml" | |
done |
This file contains 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 | |
# Author: Thyrus Gorges | |
# Date: 2015/03/04 | |
#The MIT License (MIT) | |
#Copyright (c) <2015> <Thyrus Gorges> | |
#Permission is hereby granted, free of charge, to any person obtaining a copy |
This file contains 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 C device discovery in under 5 seconds. | |
# Notice that it will display information on any MAC address that nmap knows about. It's helpful to keep this updated. | |
# You can also add any MAC address OIDs that are newer or unknown to the file /usr/share/nmap/nmap-mac-prefixes. | |
# | |
# How to call this script: | |
# nmap -n -sP --excludefile $PROJECT_ROOT/output/known.skip 10.10.100-103.1-255 | awk -f $PROJECT_ROOT/mac-sort.awk | |
# | |
BEGIN { PROJECT_PATH="/path/to/scripts"; } |
This file contains 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
grep -E -o '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)' file.txt | |
# match addresses formatted as IP/bits - e.g. 192.168.0.1/24 | |
ip addr sh eth0 | grep -E -o "([0-9]+.){3}[0-9]+/[0-9]+" |
This file contains 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/env bash | |
# | |
#create 7 constants using output of date command | |
readonly year month day hour minutes seconds epoch _ < <(date '+%Y %m %d %H %M %S %s') | |
#create 7 variables using output of date command | |
#read year month day hour minutes seconds epoch _ < <(date '+%Y %m %d %H %M %S %s') | |
echo $year $month $day $hour $minutes $seconds $epoch | |
# | |
echo | |
echo 'optimal cpu load based on number of processors and cores: ' |
This file contains 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
Update() { | |
sudo apt-get -qq clean | |
apt-get -qq update | |
} | |
# quietly install space delimited package(s) | |
Install() { | |
sudo apt-get install -qq -y --force-yes "$@" |
This file contains 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 | |
#install cryptsetup | |
apt-get install cryptsetup | |
#initializes the volume, and sets an initial key or passphrase | |
cryptsetup -y -v luksFormat /dev/xvdc | |
#the following command create a mapping | |
cryptsetup luksOpen /dev/xvdc backup2 |
This file contains 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 | |
# A simple shell to mount disk encryption based parition under Linux. | |
# Tested on Debian and Ubuntu base NAS servers. | |
# ---------------------------------------------------------------------------- | |
# Written by Vivek Gite <http://www.cyberciti.biz/> | |
# (c) 2008 nixCraft under GNU GPL v2.0+ | |
# ---------------------------------------------------------------------------- | |
# Last updated: 05/Dec/2011 | |
# ---------------------------------------------------------------------------- | |