Skip to content

Instantly share code, notes, and snippets.

View JSONOrona's full-sized avatar

Jason Orona JSONOrona

View GitHub Profile
@JSONOrona
JSONOrona / parser.py
Last active January 4, 2021 16:37
Python command line argument example using argparse module
#!/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 ]
@JSONOrona
JSONOrona / getSched.py
Last active August 29, 2015 13:56
ATG Dynamo console web scraper
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jason V. Orona'
__version__ = 'prototype'
'''
Example:
./getSched.py --server=myserver --port=8080
#!/usr/bin/env python
import thread
import time
# Global variables
MAX = 50
# Functions
def print_time( threadName, delay):
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)
# ======================================== #
# 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Refer to:
http://support.f5.com/kb/en-us/solutions/public/6000/900/sol6917.html
'''
import urllib2
import os
@JSONOrona
JSONOrona / gist:0ffd2796149d5ec85380
Created May 15, 2014 14:53
Unix Terminal Stuff
# 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
@JSONOrona
JSONOrona / dt_sys_profile.py
Last active September 26, 2015 19:28
dynaTrace System Profile Extractor
# 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
# -*- 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
#================================================================================
@JSONOrona
JSONOrona / genpasswd
Created November 29, 2014 02:10
Generates a strong random password
genpasswd() {
local l=$1
[ "$l" == "" ] && l=20
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}