Skip to content

Instantly share code, notes, and snippets.

Brown
root@nms:/home/netsapiens# lsof | grep sipbx | grep TCP
sipbx 22867 root 2036u IPv4 20609376 0t0 TCP *:sip (LISTEN)
sipbx 22867 root 2044u IPv4 20609387 0t0 TCP localhost:9991 (LISTEN)
sipbx 22867 root 2047u IPv4 20609396 0t0 TCP localhost:9992 (LISTEN)
sipbx 22867 root 2048u IPv4 20609466 0t0 TCP nms.brown.versaturelabs.net:sip->jPad-2.yow-hq.versature.net:63079 (ESTABLISHED)
Gray
root@nms:/home/netsapiens# lsof | grep sipbx | grep TCP
sipbx 23571 root 2036u IPv4 20664447 0t0 TCP *:sip (LISTEN)
def b_test_q():
global input_1, input_2, input_3
print "Input 1: "
input_1 = raw_input("=> ").capitalize()
print "'==' or '!='."
input_2 = raw_input("=> ").capitalize()
print "Input 2: "
input_3 = raw_input("=> ").capitalize()
if input_1 or input_2 or input_3 == "Q":
print input_1 + " " + input_2 + " " + input_3
#!/bin/sh
sleep 1
sed -i'' "$FIRST_LINE,$LAST_LINE s/^/#/" /root/Dropbox/PSA_All_Check
sleep 2
export FIRST_LINE=0
export LAST_LINE=0
@socalal
socalal / gist:637a77afa0baf9df4453
Last active April 18, 2016 22:24
BASH check for AR parts - socalal
#!/bin/bash
export FIRST_LINE=0
export LAST_LINE=0
if curl http://palmettostatearmory.com/index.php/ar-10/ar-10-lower-parts/psa-pa10-act-lower-parts-kit.html | grep "TEMPORARILY OUT OF STOCK" > /dev/null
then echo "$(date) - Palmetto ACT Lower Parts Kits - IT IS IN STOCK!!!!" | tee --append /var/log/PSA_log.txt
/usr/bin/mail -s "$(date) - ACT Lower Parts Kits!!" 7603905242@txt.att.net <<< "Palmetto ACT Lower Parts Kits are OUT OF STOCK!"
export FIRST_LINE=12
#!/bin/sh
sleep 1
sed -i'' "$FIRST_LINE,$LAST_LINE s/^/#/" /root/Dropbox/PSA_All_Check
@socalal
socalal / gist:529b7c5e432dd0146af6f0fbe4012797
Last active April 18, 2016 22:21
Convert decimal into hexadecimal and vice versa from a file - socalal
#!/usr/bin/python
# Created by Alan M. Orther - alan.orther@gmail.com
# Used to convert decimal into hexadecimal and vice versa from a file. Can also
# be used to create a comma separated list from a file with line separated
# values.
from sys import argv
from collections import Counter
@socalal
socalal / gist:55d43f63f1eb18175f00f9507e053c14
Last active April 18, 2016 22:20
Duplicate website - socalal
#!/usr/bin/python
# Created by Alan M. Orther - alan.orther@gmail.com
# This script is used to duplicate a Wordpress website and DB.
import os
import random
# Variables
website_url = ""
website_url_dir = ""
@socalal
socalal / gist:478c023ffa6b0302e771254f4ea20cc7
Last active April 18, 2016 22:20
Fix App Type ID - socalal
#!/usr/bin/python
# Created by Alan M. Orther - alan.orther@ingenu.com
# This script is used to find the AMI 1.0 devices that are not switching from
# App Type 10 to App Type 30 when upgrading from AMI 1.0 to AMI 1.2.
# The script will create a directory called /aotools in the user's home
# directory and read the current bus log for specific errors. The script will
# then copy the grepped log to the /aotools directory and show a list of the
# nodes that have the error in decimal and hex form. It will also provide a
# count of nodes and duplicates. I will generally use this script around 45
# minutes into the hour to provide time to make the DB changes before the
@socalal
socalal / gist:bf4f7220759cfda4bfa1717913804702
Last active April 18, 2016 22:20
Over-the-Air Node Configuration Loop - socalal
#!/usr/bin/python
# Created by Alan M. Orther - alan.orther@gmail.com
# This script is used to loops through nodes and send an over-the-air command.
import os
import time
# Create /tmp/ota_tools_logs/ directory if it does not already exist.
otatools_dir = "/tmp/ota_tools_logs/"
otatools_dir = os.path.expanduser(otatools_dir)
@socalal
socalal / gist:62dfc84786eebd59eb3bc737fe17d83d
Last active April 18, 2016 22:28
BASH DB query and email script - socalal
#!/bin/bash
DATE=$(date)
MYSQL_QUERY1="SELECT COUNT(DISTINCT(nodeId)) AS 'Unreachable Nodes' FROM Alarm WHERE firstOccurrence BETWEEN NOW() - INTERVAL 14 DAY AND NOW() AND additionalInfo LIKE '%Timeout%' AND clearedDate IS NULL;"
MYSQL_QUERY2="SELECT COUNT(DISTINCT(nodeId)) AS 'Unreachable AMI 1.0 Nodes' FROM Alarm WHERE additionalInfo LIKE '%Smart Meter 1.0%' AND id IN (SELECT id AS 'Unreachable Nodes' FROM Alarm WHERE firstOccurrence BETWEEN NOW() - INTERVAL 14 DAY AND NOW() AND additionalInfo LIKE '%Timeout%' AND clearedDate IS NULL);"
MYSQL_QUERY3="SELECT COUNT(DISTINCT(nodeId)) AS 'Unreachable AMI 1.1 Nodes' FROM Alarm WHERE additionalInfo LIKE '%Smart Meter 1.1%' AND id IN (SELECT id AS 'Unreachable Nodes' FROM Alarm WHERE firstOccurrence BETWEEN NOW() - INTERVAL 14 DAY AND NOW() AND additionalInfo LIKE '%Timeout%' AND clearedDate IS NULL);"