Skip to content

Instantly share code, notes, and snippets.

View billtaichi's full-sized avatar

Bill Carpenter billtaichi

  • Raleigh, NC
  • 16:28 (UTC -04:00)
View GitHub Profile
@billtaichi
billtaichi / new_gist_file.py
Last active December 18, 2015 21:58
Set incognito mode on selenium webdriver. (Extracted from a class)
def SetBrowserObj(self):
try:
if self.browserdriver.strip().upper() == "CHROME":
options = webdriver.chrome.options.Options()
options.add_argument("-incognito")
browser = webdriver.Chrome(chrome_options=options)
if self.browserdriver.strip().upper() == "FIREFOX":
browser = webdriver.Firefox()
self.driver = browser
@billtaichi
billtaichi / new_gist_file.py
Last active September 10, 2022 13:06
Example class that uses argparse for python
# -*- coding: utf-8 -*-
import argparse
parser = argparse.ArgumentParser(description='Run Load',
epilog="Thanks for using PF dataloads.")
parser.add_argument('-u', '--url',
help='Base URL')
parser.add_argument('-l', '--logon',
@billtaichi
billtaichi / new_gist_file
Last active December 19, 2015 11:59
Snippet to obtain Active Directory Path
public string ActiveDirectoryPath()
{
DirectoryEntry root = new DirectoryEntry("LDAP://RootDSE");
using (root)
{
string dnc = root.Properties["defaultNamingContext"][0].ToString();
string server = root.Properties["dnsHostName"][0].ToString();
string adsPath = String.Format("LDAP://{0}/{1}", server, dnc);
return adsPath;
}