Skip to content

Instantly share code, notes, and snippets.

@yee379
yee379 / phone_location.py
Last active February 15, 2023 15:32
Determine a phone number's country and region.
import yaml
def locate_phone_number( s, country_code='1', region_code='650', region_digits=7, internal_digits=4, country_digits=10, locations={}, **kwargs ):
s = str(s)
# internal number
if len(s) == internal_digits:
return 'internal', None, s
@yee379
yee379 / gist:5926619
Created July 4, 2013 10:27
dumps a bunch of snmp information from a list of devices and if indexes - stick in cron job to have easy network monitoring!
#!/bin/bash
# simple script to collect some snmp information from a list of switches and interfaces and dump the result into $DIR
# currently configured to grab the in and out octet counters
# provide a hash of the network device and the if indexes that you wish to monitor,
# eg ["rtr-farm02"]="380 53 58" will monitor the device rtr-farm02 on if index 380, 53 and 58
declare -A INTERFACES
INTERFACES=( ["swh-farm02a"]="12" ["rtr-farm02"]="380 53 58" ["rtr-farmcore1"]="117" ["rtr-core1"]="9" ["rtr-border2"]="20 3 7" )