Skip to content

Instantly share code, notes, and snippets.

View jay0lee's full-sized avatar

Jay Lee jay0lee

View GitHub Profile
@jay0lee
jay0lee / drive-upload-5tb-file.sh
Last active March 26, 2024 08:59
Upload 5tb Drive File
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" | \
#!/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})
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
#!/usr/bin/env python
#
__author__ = 'Jay Lee'
import argparse
import sys
import gdata.gauth
import gdata.contacts.client
import gdata.contacts.data
# 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'
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
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')]:
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]
@jay0lee
jay0lee / gdyn.py
Last active September 18, 2020 16:10
#!/usr/bin/env python3
import argparse
import json
import requests
import sys
import logging
parser = argparse.ArgumentParser()
parser.add_argument("--username",
#!/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" \