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
refresh_access_token () | |
{ | |
echo "Old access token: $access_token" | |
refresh_result=$(curl -s https://accounts.google.com/o/oauth2/token \ | |
-H "Content-Type: application/x-www-form-urlencoded" \ | |
-d refresh_token=$refresh_token \ | |
-d client_id=$client_id \ | |
-d client_secret=$client_secret \ | |
-d grant_type=refresh_token) | |
access_token=$(echo -e "$refresh_result" | \ |
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
#!/bin/bash | |
function patch_strings_in_file() { | |
local FILE="$1" | |
local PATTERN="$2" | |
local REPLACEMENT="$3" | |
# Find all unique strings in FILE that contain the pattern | |
HASSTRING=$(grep ${PATTERN} ${FILE}) |
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 sys | |
import argparse | |
import os | |
import sqlite3 | |
import apiclient.discovery | |
import httplib2 | |
import uritemplate | |
from oauth2client.anyjson import simplejson | |
from oauth2client.client import flow_from_clientsecrets |
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 | |
# | |
__author__ = 'Jay Lee' | |
import argparse | |
import sys | |
import gdata.gauth | |
import gdata.contacts.client | |
import gdata.contacts.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
# Store our credentials in our home directory with a file called .<script name> | |
my_creds=~/.`basename $0` | |
client_id='716905662885.apps.googleusercontent.com' | |
client_secret='CMVqIy_iQqBEMlzjYffdYM8A' # not really a secret | |
if [ -s $my_creds ]; then | |
# if we already have a token stored, use it | |
. $my_creds | |
time_now=`date +%s` | |
else | |
scope='https://www.googleapis.com/auth/admin.directory.user.readonly' |
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
username | firstname | lastname | password | |
---|---|---|---|---|
jsmith | John | Smith | p@ssw3rd | |
janesmith | Jane | Smith | s3cret | |
joesmith | Joe | Smith | blackd0g | |
jimsmith | Jim | Smith | wh1it3cAt | |
jacksmith | Jack | Smith | blu3FisH | |
johndoe | John | Doe | R3dHors3 | |
janedoe | Jane | Doe | GreenFr0g | |
msanders | Michael | Sanders | YellowTurtle | |
boballen | Bob | Allen | PurpleSnake |
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
from xml.etree import ElementTree as ET | |
import requests | |
from html.parser import HTMLParser | |
import string | |
import dateutil.parser | |
class MyHTMLParser(HTMLParser): | |
def handle_starttag(self, tag, attrs): | |
global next_data_is_oem, next_data_is_td | |
if tag == 'h2' and attrs == [('class', 'zippy')]: |
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 json | |
import httplib2 | |
import sys | |
from googleapiclient import discovery | |
from google.oauth2 import service_account | |
def divide_chunks(l, n): | |
for i in range(0, len(l), n): | |
yield l[i:i + n] |
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 python3 | |
import argparse | |
import json | |
import requests | |
import sys | |
import logging | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--username", |
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 python3 | |
### This script requires PyJWT. Install it by running: | |
### | |
### pip3 install PyJWT | |
### | |
### Example usage on Linux with curl to call Admin SDK Directory API users.get() | |
### | |
### curl -vvvv \ | |
### -H "accept: application/json" \ |
OlderNewer