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/bin/python | |
''' Python command line argument example using argparse module | |
Example output: | |
./parser.py --server=pyserver --port=8080,443,25,22,21 --keyword=pyisgood | |
Server name: [ pyserver ] |
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/bin/env python | |
# -*- coding: utf-8 -*- | |
__author__ = 'Jason V. Orona' | |
__version__ = 'prototype' | |
''' | |
Example: | |
./getSched.py --server=myserver --port=8080 |
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/bin/env python | |
import thread | |
import time | |
# Global variables | |
MAX = 50 | |
# Functions | |
def print_time( threadName, delay): |
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
import Queue | |
import threading | |
import urllib2 | |
import random | |
worker_data = ['http://www.ebay.com', 'http://google.com', 'http://yahoo.com', 'http://bing.com'] | |
#load up a queue with your data, this will handle locking | |
q = Queue.Queue() | |
randomized_urls = random.shuffle(worker_data) |
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
# ======================================== # | |
# Speed up sandbox manipulation for python # | |
# ======================================== # | |
# Add these scripts to your .bashrc in order to help you using virtualenv and automate the creation and activation processes. | |
rel2abs() { | |
#from http://unix.derkeiler.com/Newsgroups/comp.unix.programmer/2005-01/0206.html | |
[ "$#" -eq 1 ] || return 1 | |
ls -Ld -- "$1" > /dev/null || return |
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
# Add this to .profile in korn shell that doesnt behave with your terminal | |
# Terminal fixes | |
stty erase ^? # Fixes backspace issue | |
# Enables the ability to view command history | |
# with arrow keys | |
set -o emacs | |
alias __A=$(print '\0020') # ^P = up = previous command | |
alias __B=$(print '\0016') # ^N = down = next command |
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
# Modules | |
import xml.etree.ElementTree as ET | |
import re | |
# Global Variables | |
FILE = 'application.profile.xml' | |
# Load and parse the document | |
tree = ET.ElementTree(file=FILE) | |
# Fetch the root element and move down an element |
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
# -*- coding: utf-8 -*- | |
#!/usr/bin/env python | |
# Title : ConfluenceClient.py | |
# Description : Confluence xml-rpc client | |
# Author : Jason Orona | |
# Date : 07/08/14 | |
# Version : 1.0 | |
# Usage : Usage: ConfluenceClient.py -f file -n namespace -p pagename | |
# python_version : 2.6.6 | |
#================================================================================ |
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
genpasswd() { | |
local l=$1 | |
[ "$l" == "" ] && l=20 | |
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs | |
} |
OlderNewer