Skip to content

Instantly share code, notes, and snippets.

View Avantol13's full-sized avatar
🎹

Alexander VanTol Avantol13

🎹
  • CTDS - University of Chicago
View GitHub Profile
@Avantol13
Avantol13 / command_line_interface.py
Last active May 28, 2016 21:39
Simple example of a command line interface for Python using argparse and colorama
#!/usr/bin/env python3
'''
Pretty Command Line Interface Example v1.1
@author: Alexander VanTol
'''
import sys
import traceback
import argparse
from colorama import init, Fore, Back, Style
@Avantol13
Avantol13 / backup.py
Last active April 21, 2016 00:44
simple python backup script with command line functionality
#!/usr/bin/env python3
'''
Created on Apr 20, 2016
@author: alex.vantol
BACKUP SCRIPT - w/ CLI
Takes a folder and location as input.
Outputs a zip file at given location
containing the contents of the input folder.
@Avantol13
Avantol13 / AutoHotkey.ahk
Last active March 20, 2025 14:38
AutoHotKey script with text conversion to upper, lower, invert, CamelCase to CAP_CASE, and CAP_CASE to CamelCase
; Quick Text Formatting/Style Changes and Other Helpful Windows Tools
; - High-compatibility and unifies keyboard shortcuts b/t programs
; - Shortcuts for converting selected text to the following:
; All lower: THIS_is-a_tESt -> this_is-a_test
; All Upper: THIS_is-a_tESt -> THIS_IS-A_TEST
; Caps case: ThisIsAnExample -> THIS_IS_AN_EXAMPLE
; thisIsAnExample -> THIS_IS_AN_EXAMPLE
; Camel Case: THIS_IS_AN_EXAMPLE -> ThisIsAnExample
; this_is_an_example -> ThisIsAnExample
; tHIS_Is_an_ExAmPLE -> ThisIsAnExample.
@Avantol13
Avantol13 / shortcut_properties
Created July 26, 2016 20:13
Relative Windows Shortcut
- Right-click shortcut -> Properties -> Shortcut tab -> Target:
%windir%\system32\cmd.exe /c start "" "%CD%\this\is\relative\to\shorcut\location"
- Make sure "Start in:" is empty
- You can use "Change Icon..." too
- Look for icons in file: %SystemRoot%\system32\SHELL32.dll
@Avantol13
Avantol13 / decline_outlook_meeting_mult_times
Last active August 18, 2016 19:14
Outlook VBA Script to Decline a Meeting Invitation Email Multiple Times
NOTE: Only use on friends.
Must have email invite for meeting selected, then run this VBA script
as an Outlook Macro (Need Developer pane showing to create/use macro).
-----------------------------------------------------------------------
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Purpose
--------------------------------------------------------------------------------------------
Change Windows default name for copied files. Is usually OriginalFileName - Copy.ext
Directions
-------------------------------------------------------------------------------------------
In Windows registry: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer
- Add key : NamingTemplates
- Add new String Value : CopyNameTemplate
- Add Data for CopyNameTemplate: <New default here>
# Redirect print output to null device on operating system
print_redirect = open(os.devnull, 'w')
sys.stdout = print_redirect
# See this: http://stackoverflow.com/a/6735958/4175042
import argparse
import sys
import os
def main():
'''
Entry point of script
'''
# Parse arguments into script
"""
NATURAL LOG LOOKUP TABLE GENERATOR
Generates a lookup table for the natural log function given a lower and upper bound
Points chosen ensure that linear approximation between the points minimize error
within the MAX_PERCENT_ERROR provided.
You can adjust the MAX_PERCENT_ERROR, realizing that a smaller error will require
more data points. The length of the resulting list should be printed to standard output.
@Avantol13
Avantol13 / connection_example.py
Last active April 30, 2018 20:44
Issues with Listing Groups in Google Cloud Identity by use of Admin Directory v1 API and Domain Wide Delegation of a Service Account in GCP
from config import GOOGLE_APPLICATION_CREDENTIALS
from config import GOOGLE_APPLICATION_CREDENTIALS_P12
from config import GOOGLE_CLOUD_IDENTITY_ADMIN_EMAIL
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client.service_account import ServiceAccountCredentials
def connection_test():